开发者

How to the same thing with omniauth

Reading on this oauth tutorial.

I 开发者_C百科would like to do exactly the same thing using the Omniauth gem, to get the access tokens from Twitter's API.

#oauth = OAuth::Consumer.new(APP_CONFIG['twitter_consumer_key'], APP_CONFIG['twitter_consumer_secret'], :site => 'http://api.twitter.com', :request_endpoint => 'http://api.twitter.com', :sign_in => true)

# Get the request tokens from the API
rt = oauth.get_request_token
rtoken = rt.token # request token
rsecret = rt.secret # request token secret

# Go to url and click ""Allow access” when prompted
# http://api.twitter.com/oauth/authorize?oauth_token=your_request_token_from_above

# Get the access tokens from the API
at = rt.get_access_token
oauth_token = at.token
oauth_token_secret = at.secret

Anyone know how this can be achieved?


Here it is a good howto, take a look:

http://philsturgeon.co.uk/blog/2010/11/using-omniauth-to-make-twitteroauth-api-requests

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜