Error handling for the authentication