Add some exception handling to auth attempts. Fixes #9150
(cherry picked from commit d832b6ce47a90fea03443401d072eb91906b6fc7)
Add some exception handling to auth attempts. Fixes #9150
(cherry picked from commit d832b6ce47a90fea03443401d072eb91906b6fc7)