Search code examples
facebook-graph-apifacebook-oauthfacebook-authenticationfacebook-node-sdk

Renew facebook access token from Node


In my Node application, I store in the DB a long-lived user facebook access token and run a cron periodically.

There's a way to renew that access token after the 60 days without asking the user to renew it in my mobile app? I use fbgraph node module to communicate with the graph API, so maybe there's a way to renew that token from the backend itself without going to the mobile app, ask for status and login again with the JavaScript SDK.


Solution

  • Tokens always need to be refreshed with user interaction, there is no way to auto-refresh them.

    But you don´t need to login again, you just need to use this function to refresh the User Token: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/