0

I am using facebooker2 that uses Mogli for Facebook Authentication and I would like to save the created access_token to the database. Its already saving the access_token to the created cookie but I would like to save it to the database as well. Is that possible? Can anyone provide an example?

Thanks.

glarkou
  • 7,023
  • 12
  • 68
  • 118

1 Answers1

1

Facebooker2 provides the method current_facebook_client, which you can use from a controller to obtain the access_token and then save it to the database (e.g.: a fb_access_token field of the User model):

at = current_facebook_client.access_token
current_user.update_attribute(:fb_access_token, at)
gparis
  • 1,247
  • 12
  • 32