glarkou
glarkou

Reputation: 7101

Save access_token

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.

Upvotes: 0

Views: 421

Answers (1)

gparis
gparis

Reputation: 1267

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)

Upvotes: 1

Related Questions