Public Member Functions | |
def | authorize_redirect |
def | get_authenticated_user |
Private Member Functions | |
def | _oauth_consumer_token |
def | _oauth_get_user_future |
Static Private Attributes | |
string | _OAUTH_ACCESS_TOKEN_URL = "https://www.google.com/accounts/OAuthGetAccessToken" |
string | _OPENID_ENDPOINT = "https://www.google.com/accounts/o8/ud" |
Google Open ID / OAuth authentication. .. deprecated:: 4.0 New applications should use `GoogleOAuth2Mixin` below instead of this class. As of May 19, 2014, Google has stopped supporting registration-free authentication. No application registration is necessary to use Google for authentication or to access Google resources on behalf of a user. Google implements both OpenID and OAuth in a hybrid mode. If you just need the user's identity, use `~OpenIdMixin.authenticate_redirect`. If you need to make requests to Google on behalf of the user, use `authorize_redirect`. On return, parse the response with `~OpenIdMixin.get_authenticated_user`. We send a dict containing the values for the user, including ``email``, ``name``, and ``locale``. Example usage:: class GoogleLoginHandler(tornado.web.RequestHandler, tornado.auth.GoogleMixin): @tornado.gen.coroutine def get(self): if self.get_argument("openid.mode", None): user = yield self.get_authenticated_user() # Save the user with e.g. set_secure_cookie() else: yield self.authenticate_redirect()
def tornado.auth.GoogleMixin._oauth_consumer_token | ( | self | ) | [private] |
Subclasses must override this to return their OAuth consumer keys. The return value should be a `dict` with keys ``key`` and ``secret``.
Reimplemented from tornado.auth.OAuthMixin.
def tornado.auth.GoogleMixin._oauth_get_user_future | ( | self, | |
access_token | |||
) | [private] |
def tornado.auth.GoogleMixin.authorize_redirect | ( | self, | |
oauth_scope, | |||
callback_uri = None , |
|||
ax_attrs = ["name" , |
|||
email, | |||
language, | |||
username, | |||
callback = None |
|||
) |
Authenticates and authorizes for the given Google resource. Some of the available resources which can be used in the ``oauth_scope`` argument are: * Gmail Contacts - http://www.google.com/m8/feeds/ * Calendar - http://www.google.com/calendar/feeds/ * Finance - http://finance.google.com/finance/feeds/ You can authorize multiple resources by separating the resource URLs with a space. .. versionchanged:: 3.1 Returns a `.Future` and takes an optional callback. These are not strictly necessary as this method is synchronous, but they are supplied for consistency with `OAuthMixin.authorize_redirect`.
def tornado.auth.GoogleMixin.get_authenticated_user | ( | self, | |
callback | |||
) |
string tornado::auth.GoogleMixin::_OAUTH_ACCESS_TOKEN_URL = "https://www.google.com/accounts/OAuthGetAccessToken" [static, private] |
string tornado::auth.GoogleMixin::_OPENID_ENDPOINT = "https://www.google.com/accounts/o8/ud" [static, private] |