

@_auth_return_future
def get_authenticated_user(self, callback, http_client=None):
    'Gets the OAuth authorized user and access token.\n\n        This method should be called from the handler for your\n        OAuth callback URL to complete the registration process. We run the\n        callback with the authenticated user dictionary.  This dictionary\n        will contain an ``access_key`` which can be used to make authorized\n        requests to this service on behalf of the user.  The dictionary will\n        also contain other fields such as ``name``, depending on the service\n        used.\n        '
    future = callback
    request_key = escape.utf8(self.get_argument('oauth_token'))
    oauth_verifier = self.get_argument('oauth_verifier', None)
    request_cookie = self.get_cookie('_oauth_request_token')
    if (not request_cookie):
        future.set_exception(AuthError('Missing OAuth request token cookie'))
        return
    self.clear_cookie('_oauth_request_token')
    (cookie_key, cookie_secret) = [base64.b64decode(escape.utf8(i)) for i in request_cookie.split('|')]
    if (cookie_key != request_key):
        future.set_exception(AuthError('Request token does not match cookie'))
        return
    token = dict(key=cookie_key, secret=cookie_secret)
    if oauth_verifier:
        token['verifier'] = oauth_verifier
    if (http_client is None):
        http_client = self.get_auth_http_client()
    http_client.fetch(self._oauth_access_token_url(token), self.async_callback(self._on_access_token, callback))

dataset/ETHPy150Open D-L/SimpleBookMarks/src/tornado/auth.py OAuthMixin.get_authenticated_user/original