Extract out method for generating the auth header