OmniAuth Facebook expired token error

前端 未结 3 899
滥情空心
滥情空心 2021-02-04 22:14

I am using OmniAuth to get access to Facebook in my app. I am using the fb_graph gem: https://github.com/nov/fb_graph to post to Facebook. I am running omniauth-0.3.0 on Heroku

3条回答
  •  鱼传尺愫
    2021-02-04 22:55

    Can't we refresh the token using FBGraph gem with follwing method in such case?

    auth = FbGraph::Auth.new(CLIENT_ID, CLIENT_SECRET)
    auth.exchange_token! access_token # Needs fb_graph 2.3.1+
    auth.access_token # => new token
    

    However, This will not extend token's expiry but will replace token with new one. Expiry time will remain same. Checked it with FB, They may not allow to extend FB token expiry more than 60 days. Maximum token validity is 60-days.

    reference: https://github.com/nov/fb_graph/wiki/Authentication#wiki-extend-token-expiry

提交回复
热议问题