'Handles the login for the Google user, returning a user object.
Example usage::
class GoogleOAuth2LoginHandler(tornado.web.RequestHandler,
tornado.auth.GoogleOAuth2Mixin):
@tornado.gen.coroutine
def get(self):
if self.get_argument(\'code\', False):
user = yield self.get_authenticated_user(
redirect_uri=\'http://your.site.com/auth/google\',
code=self.get_argument(\'code\'))
# Save the user with e.g. set_secure_cookie
else:
yield self.authorize_redirect(
redirect_uri=\'http://your.site.com/auth/google\',
client_id=self.settings[\'google_oauth\'][\'key\'],
scope=[\'profile\', \'email\'],
response_type=\'code\',
extra_params={\'approval_prompt\': \'auto\'})'

@_auth_return_future
def get_authenticated_user(self, redirect_uri, code, callback):

    http = self.get_auth_http_client()
    body = urllib_parse.urlencode({'redirect_uri': redirect_uri, 'code': code, 'client_id': self.settings[self._OAUTH_SETTINGS_KEY]['key'], 'client_secret': self.settings[self._OAUTH_SETTINGS_KEY]['secret'], 'grant_type': 'authorization_code'})
    http.fetch(self._OAUTH_ACCESS_TOKEN_URL, functools.partial(self._on_access_token, callback), method='POST', headers={'Content-Type': 'application/x-www-form-urlencoded'}, body=body)
