litl / rauth

A Python library for OAuth 1.0/a, 2.0, and Ofly.
http://readthedocs.org/docs/rauth/en/latest/
MIT License
1.6k stars 174 forks source link

Foursquare expects 'oauth_token' instead of 'access_token' #9

Closed lrvick closed 12 years ago

lrvick commented 12 years ago

Using the following fails as Fourquare expects the access_token to be provided as 'oauth_token'

profile = service.request(
    'GET',
    'https://api.foursquare.com/v2/users/self' ,
    access_token=token
).content

Currently I am using the following dirty hack which works:

profile = service.request(
    'GET',
    'https://api.foursquare.com/v2/users/self?oauth_token=%s' % token,
    access_token=token,
).content

Really I think this is more Fourquare's fault for not using the same argument name as everyone else... however a nicer workaround or argument option in rauth would be nice.

Perhaps just add and 'oauth_token' option to request() that does the same thing as 'access_token' and require one of them, but not both?

maxcountryman commented 12 years ago

I think what we should do here is pass the access token as a generic parameter of the request.

maxcountryman commented 12 years ago

I'm working on changing the way request objects are created and wrapping them in an extended API which will directly mirror Requests without breaking too much in the process. I'll close this issue when that's done. Thanks! :cake:

maxcountryman commented 12 years ago

Hi again, I've pushed some updates to the API that I think should address this issue. Be aware that these were breaking changes so you may have to teak things a little bit. However I think it's worth it as the modified API is more generic and should (hopefully) avoid these issues. Thanks for reporting this issue! :)