Added error handling for Authentiacation method