开发者

Rails - Using twitter oAuth for logging in users

I use Twitter oAuth to allow users to signup for my site.

I have the user's access_token, access_secret from their signup stored.

When the user wants to return to the site and login to their account, how do I authenticate them using twitter login/password?

I do not want to ask users to give access like:

- give access to example.com to read/write your stuff on twitter

The user already has signed up using their twitter credentials, how do I reuse开发者_Go百科 it instead of asking them to create a separate password?

I would rather not venture towards authlogic in addition to oauth

Currently, if the user is already logged into twitter, I can authenticate him. using the access_token, access_secret. What if he is not logged in? How do I prompt for username/password for twitter and authenticate for my app?

Thanks for your help.


Try using them OmniAuth gem. Makes doing that pretty straight forward.

If you're not wanting another gem dependency, you could probably code up your own functionality based on what they do with their twitter strategy and abstract oauth logic.


This RailsCasts episode demonstrates how to create a simple authentication system that only requires an OAuth verification, without the need for a seperate user account maintained by your app.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜