views:

146

answers:

1

I'm trying to figure out Foursquare's OAuth so I can have a user sign into my app. So far I found this tutorial: http://pkarl.com/articles/connect-foursquare-api-oauth-python/

Unfortunately, it doesn't work. I got the same error message the commenters were getting. If anyone knows what the tutorial did wrong or knows another way of authenticating a foursquare account with OAuth, I would love to hear!

+1  A: 

Okay, I figured it out. Instead, I used this: http://github.com/wiseman/foursquare-python/tree/16138f7be20ec9ab6b58315dad9ee9765e73bb84

I already had the user_key and user_secret on hand, so it was just a matter of a few lines:

import foursquare
import oauth
credentials = foursquare.OAuthCredentials(consumer_key, consumer_secret)
fs = foursquare.Foursquare(credentials)
user_token = oauth.OAuthToken(user_key, user_secret)
credentials.set_access_token(user_token)
print fs.user()