Raise better exceptions if authentication fails.