简体   繁体   English

保存 access_token

[英]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.我正在使用使用 Mogli 进行 Facebook 身份验证的 facebooker2,我想将创建的 access_token 保存到数据库中。 Its already saving the access_token to the created cookie but I would like to save it to the database as well.它已经将 access_token 保存到创建的 cookie 中,但我也想将其保存到数据库中。 Is that possible?那可能吗? Can anyone provide an example?谁能提供一个例子?

Thanks.谢谢。

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 (eg: a fb_access_token field of the User model): Facebooker2 提供方法 current_facebook_client,您可以从 controller 中使用该方法获取 access_token,然后将其保存到数据库中(例如:用户模型的 fb_access_token 字段):

at = current_facebook_client.access_token
current_user.update_attribute(:fb_access_token, at)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM