I'm upgrading to the latest Android and iOS sdks for Facebook and had two question.
Now that we have a concept of an
access token that has to be refreshed periodically, I have been reading about the iOS SDK and noticed the below in the SDK:
@abstract Refresh the current access token's permission state and extend the token's expiration date,
@param completionHandler an optional callback handler that can surface any errors related to permission refreshing.
@discussion On a successful refresh, the currentAccessToken will be updated so you typically only need to
observe the `FBSDKAccessTokenDidChangeNotification` notification.
If a token is already expired, it cannot be refreshed.
This method is for refreshing the SDK and is in the class
FBSDKAccessToken. On the Android side I'm trying to find out if the same is true and read the code as well as documentation on this, it doesn't say if the
AccessToken class's refresh method (
refreshCurrentAccessTokenAsync) has to be called before expiration.
I have read this in the documentation:
getLastRefresh() it says the below:
Gets the date at which the token was last refreshed. Since tokens expire, the Facebook SDK will attempt to renew them periodically.
This is unlike iOS where refreshing doesn't happen automatically. Is my assumption correct? That the iOS and Android sdks are handling refreshing differently?
Also, what is the best practice for refreshing tokens? I have been refreshing tokens in
didFinishLaunchingWithOptions in iOS and on Android I do it when the application loads. However, it would help if there was more information on the best strategy with the SDKs.
I have been reading the following on this:
The access token will get refreshed automatically in the Android SDK if you make a graph request (it gets piggy-backed onto the request that you make).