Fixes #8398 - Authentication error returns 500