finding friends in a rails app via facebook, gmail, twitter, etc

笑着哭i 提交于 2019-12-11 06:16:43

问题


I have built a social networking app in rails, and am looking for a simple way to allow users to login to their various other accounts (OAuth?) such as facebook, twitter, gmail, other mail clients, etc and see if their friends/contacts on those sites are signed up for my site.

Additionally I will be adding functionality to allow users to invite their non-signed up friends to my site via these same sites.

In the future I will also want to make it so that users can post their submissions on my site to these various other sites.

At this moment though, the most important feature is enabling users to see which of their contacts on these other sites are signed up for my site.

What is the best way to go about this? What gems should I be looking for (OAuth, RFacebook, Facebooker, etc).

I am currently using restful authentication (Also, can someone point me in the direction of a question that answers how to allow users to sign in, using restful authentication, using their username OR their email?)

Thanks!


回答1:


It's been ages since this was posted, but I felt it might be relevant to anyone who happens upon this question, the best way to do this is using the https://github.com/intridea/omniauth gem.

For invites you should take a look at https://github.com/Diego81/omnicontacts.

Also, if you are using a newer version of Rails and devise then you should check out this screen cast by Ryan Bates on using omniauth with Devise http://railscasts.com/episodes/235-devise-and-omniauth-revised.




回答2:


I used omniauth gem for oauth authentication and then used fb_graph to fetch friend list from facebook. And i guess contact gem would help pulling friends from gmail, ymail and etc.




回答3:


I think you'll find that each service has its own API and it will be up to you to connect your application individually to each service.

Here are the API docs for Facebook, Twitter and GMail

Just Google "<Site name> API"



来源:https://stackoverflow.com/questions/3579575/finding-friends-in-a-rails-app-via-facebook-gmail-twitter-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!