Adding code for Handling Authentication