Skip to content

HTTP Error 401: Unauthorized #4

@oamm

Description

@oamm

I trying yo use the api for 500px but i have some troubles, in the first step all is fine, i can generate OAuthHandler handler and get the url authorization then redirect the user to it, but when 500px.com redirect to my app and i try to create again the OAuthHandler next i try to pass the oauth_verifier to new handler but the 500px response me "HTTP Error 401: Unauthorized" and i don't know why

class FiveHundredpx(web.RequestHandler):
def get(self):
    oauth_token = self.get_argument('oauth_token', None)
    oauth_verifier = self.get_argument('oauth_verifier', None)
    if not oauth_verifier:
        handler = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
        token = handler.get_request_token()

        self.set_cookie('oauth_token', token.key)
        self.set_cookie('oauth_token_secret', token.secret)
        self.redirect(handler.get_authorization_url()+'&display=popup')
    else:

        handler = OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
        handler.set_request_token(self.get_cookie('oauth_token'), self.get_cookie('oauth_token_secret'))
        handler.set_access_token(oauth_token, self.get_cookie('oauth_token_secret'))
        handler.get_access_token(oauth_verifier)
        unauthorized_api = FiveHundredPXAPI(handler)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions