I have seen lot of people writting pretty messy code to integrate social logins in rails or get confused to integrate multiple social logins in rails. In order to help them I have written a small application having integrations with Twitter + Facebook + Linkedin + Google + Github.
I am using devise in this application. Few things to note in this:
There are two models in this application a user model and an authorizations model and a user has_many authorizations.
User can link to multiple social account from edit profile
Once social accounts are linked, user can login from any connected social network.
If user tries to create an account with a different social network while in loggedout state. System maps it to the same account if that email address exists in the database else it will create a new account.
Twitter don’t provide email address of the user, nothing I can do about it.
There are lot of other commented out gems in the Gemfile. Those are the gems that I use a lot in my various projects. I will strongly suggest you to checkout those gems.