Updated the auth function