I have a Rails web service running with Devise + OmniAuth. I have users authenticating against Facebook Connect on a mobile device. I then want the mobile device to establish a session with our web services. What do I need to pass to device from the mobile client to establish this session? Is there a code sample on the Rails side of things of how to handle this id+token that is passed from facebook -> mobile -> web service?
Share
I have not found a good way of doing this. I am not using
:omniauthableeither, I’m using OmniAuth and Devise separately as seen in the Railscast episode where there are two tablesusersandauthentications. It’s kinda hacky and only works for Facebook.Basically, send your access_token from the iPhone to the server over SSL, or something similar. You have to check with OmniAuth first and if you are granted access, then you can manually create a session with OmniAuth by going something like:
I did get something to work by doing this though:
After that you lookup the user info you need to find the user via your Authentications table:
Now we create a session: