0

I am using Devise and I have it so a User clicks "log in with facebook". Once they confirm this, it then takes them to the registration url "http://0.0.0.0:3000/users/sign_up".

In here I then populate the name and email fields with the ones I got from Facebook. They now just have to pick a password to sign up. I also want to save the user's Facebook UID and their Facebook url.

How do I pass this into my User model once the user clicks on the sign up button? (I updated my model to include these extra fields).

Edit: I currently also store their Facebook hash data in a session that I got from Ominauth so that I can retrieve it later.

Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
Kevin
  • 625
  • 2
  • 11
  • 19

1 Answers1

0

Using the auth hash provided by Omniauth you should be able to retrieve the user information.

For example the hash has a structure that looks like this. You can pull the user information like this:

facebook_uid = user_auth.uid
facebook_url = user.user_info.urls
Devin M
  • 9,636
  • 2
  • 33
  • 46
  • I was able to get the id and url but now how do I put this in with the user once they click sign up. I want to save it with their account. – Kevin Jun 10 '11 at 16:25
  • You say you have access to the hash right? Override the devise controllers new method to store the data values you want. http://stackoverflow.com/questions/3546289/override-devise-registrations-controller – Devin M Jun 10 '11 at 16:35
  • Please checkout this Railscast http://railscasts.com/episodes/236-omniauth-part-2 – Dex Jun 10 '11 at 21:14