OAuthTOKENCredential has a RefreshTokenAsync()
That one was deprecated in 200.6 in favor of OAuthUserCredential. How do I refresh the access token within this credential? Or is that built in?
If it's built in, can I get a notification that the access token has refreshed?
EDIT:
I have now found docs for OAuthUserCredential.GetTokenInfoAsync():
If the access token has expired, this method regenerates it. If the AuthUserConfiguration.RefreshTokenExchangeInterval is set, this method exchanges the refresh token at specified interval. While regenerating the access token or exchanging the refresh token, if the refresh token is expired, an exception will be thrown.
We store the creds in a custom CredentialPersistence that saves the data locally on device. What would be a recommended flow for an app that is offline 10% of the time? Do I need to call into GetTokenInfoAsync() at least once to kick off the token refresh? Should I call GetTokenInfoAsync() every time the app comes online?
Regarding my earlier question about notifying when the token refreshed - we use the ArcGIS access token to authenticate to a custom API running a SignalR hub as well, and we need to restart the connection when the token is refreshed. With OAuthTOKENCredential the app would refresh the token manually and we'd restart the SignalR connection.
I now see that call to GetTokenInfoAsync() does not refresh the token if it's not expired. How can I either force the refresh or get notified when the token is actually refreshed?
Solved! Go to Solution.
> How do I refresh the access token within this credential? Or is that built in?
It's built-in.
> If it's built in, can I get a notification that the access token has refreshed?
The persistence datasource should automatically get notified if a credential gets updated, so that you can re-save the credential.
> How do I refresh the access token within this credential? Or is that built in?
It's built-in.
> If it's built in, can I get a notification that the access token has refreshed?
The persistence datasource should automatically get notified if a credential gets updated, so that you can re-save the credential.