def get_authenticated_user(self, callback):
        """Gets the OAuth authorized user and access token on callback.

        This method should be called from the handler for your registered
        OAuth Callback URL to complete the registration process. We call
        callback with the authenticated user, which in addition to standard
        attributes like 'name' includes the 'access_key' attribute, which
        contains the OAuth access you can use to make authorized requests
        to this service on behalf of the user.

        :param callback:
        :returns:
        """
        request_key = self.request.args.get('oauth_token')
        oauth_verifier = self.request.args.get('oauth_verifier', None)
        request_cookie = self.request.cookies.get('_oauth_request_token')

        if request_cookie:
            parts = request_cookie.split('|')
            if len(parts) == 2:
                try:
                    cookie_key = base64.b64decode(parts[0])
                    cookie_secret = base64.b64decode(parts[1])
                except __HOLE__, e:
                    # TypeError: Incorrect padding
                    logging.exception(e)
                    request_cookie = None
            else:
                request_cookie = None

        if not request_cookie:
            return callback(None)

        self.session_store.delete_cookie('_oauth_request_token')

        if cookie_key != request_key:
            return callback(None)

        token = dict(key=cookie_key, secret=cookie_secret)
        if oauth_verifier:
            token['verifier'] = oauth_verifier

        try:
            url = self._oauth_access_token_url(token)
            response = urlfetch.fetch(url, deadline=10)
        except urlfetch.DownloadError, e:
            logging.exception(e)
            response = None

        return self._on_access_token(callback, response)
dataset/ETHPy150Open moraes/tipfy/tipfy/auth/oauth.py/OAuthMixin.get_authenticated_user