Facebook token usage, expiration, refresh


In my application, I would like users to login with Facebook and then later be able to upload images from Facebook into my app/service.
The login part works fine currently. But how do I handle, say if a day or two later, I need to use the facebook graph API to get some extra stuff ? Will the same token from login still work? Or do i need to handle the refresh myself?

I can’t seem to find token refresh functionality. Only method i see is logInWithReadPermissionsAsync…

Any help is appreciated.


Hey @apps.eugene,

When you log in with the Facebook module, one of the properties returned is expires. This has a value of the seconds in Epoch time at which the token will expire. I’d recommend storing that with SecureStore or AsyncStorage and then running a check to see if the current epoch time is greater than the expires time and if it is, delete the token from storage.


I think that makes sense in terms of knowing and handling the existing token. But once it has expired, how do I go about smoothly handling subsequent requests to the Facbook graph API? In my example, maybe the user will want to bring in some additional information from Facebook into my app, but at a later time. Do I have to go thru the login process again?
I also want to note that I am using Firebase facebook auth provider. So I think Firebase is handling the token renewal… Would I be able to get the renewed token from them and use it to pass to the graph api?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.