示例#1
0
    def auth_complete(self, oauth_token, oauth_verifier):
        """Return user, might be logged in"""
        name = self.AUTH_BACKEND_NAME + 'unauthorized_token_name'
        unauthed_token = self.request.session[name]
        del self.request.session[name]
        if not unauthed_token:
            raise ValueError('Missing unauthorized token')

        token = Token.from_string(unauthed_token)
        if token.key != oauth_token:
            raise ValueError('Incorrect tokens')

        access_token = self.access_token(token, oauth_verifier)

        data = self.user_data(access_token)
        return data
示例#2
0
    def auth_complete(self, oauth_token, oauth_verifier):
        """Return user, might be logged in"""
        name = self.AUTH_BACKEND_NAME + 'unauthorized_token_name'
        unauthed_token = self.request.session[name]
        del self.request.session[name]
        if not unauthed_token:
            raise ValueError('Missing unauthorized token')

        token = Token.from_string(unauthed_token)
        if token.key != oauth_token:
            raise ValueError('Incorrect tokens')

        access_token = self.access_token(token, oauth_verifier)
        
        data = self.user_data(access_token)
        return data
示例#3
0
 def access_token(self, token, oauth_verifier):
     """Return request for access token value"""
     request = self.oauth_request(token, self.ACCESS_TOKEN_URL,
                                  oauth_verifier)
     return Token.from_string(self.fetch_response(request))
示例#4
0
 def unauthorized_token(self):
     """Return request for unauthorized token (first stage)"""
     request = self.oauth_request(token=None, url=self.REQUEST_TOKEN_URL)
     response = self.fetch_response(request)
     return Token.from_string(response)
示例#5
0
 def access_token(self, token, oauth_verifier):
     """Return request for access token value"""
     request = self.oauth_request(token, self.ACCESS_TOKEN_URL, oauth_verifier)
     return Token.from_string(self.fetch_response(request))
示例#6
0
 def unauthorized_token(self):
     """Return request for unauthorized token (first stage)"""
     request = self.oauth_request(token=None, url=self.REQUEST_TOKEN_URL)
     response = self.fetch_response(request)
     return Token.from_string(response)