(bug 4062) Refactor auth to return reason.