alexis-mignon / python-flickr-api

A python implementation of the Flickr API
BSD 3-Clause "New" or "Revised" License
367 stars 108 forks source link

Authorization steps not working #72

Closed dkirkby closed 6 years ago

dkirkby commented 8 years ago

I am following the steps described in the tutorial and everything goes fine until I call the set_verifier method, and it tries to access https://www.flickr.com/services/oauth/access_token:

  File "/Users/david/anaconda/lib/python2.7/site-packages/flickr_api/auth.py", line 141, in set_verifier
    resp = urllib2.urlopen(req.to_url())
...
urllib2.HTTPError: HTTP Error 401: Unauthorized

Are the instructions still valid?

dkirkby commented 8 years ago

If I access the same URL that auth.py uses, including all its params, the response includes:

oauth_problem=signature_invalid

I also compared with the example URL here and noticed that you don't explicitly specify:

&oauth_version=1.0

Could that be a problem?

dkirkby commented 8 years ago

I also noticed that the oauth_token you send does not match the one provided with the oauth_verifier from the previous step, unlike in the example here.

dkirkby commented 8 years ago

I am able to complete the authorization sequence and get an access token using requests_oauthlib and following this gist, so it looks like the problem here is related to how requests are signed. This package looks like a great wrapper of the flickr API, so its too bad that it is no longer working.

tomquirk commented 7 years ago

@dkirkby - it is still definitely working. I think there is caching happening somewhere that caches the oauth-token. Basically, if you mess up the steps on your first go and retry, the oauth_token is not updated, meaning the new oauth_verifier is mismatched/invalid, hence 401.

If you start from scratch in another environment it should work (did for me at least).

alexis-mignon commented 6 years ago

Since nobody could replicate the problem, I close the issue. Reopen it if needed.