Token expiration handler
Configure expiration handler to refresh access tokens automatically.
The accessToken has a limited lifespan. To refresh it when it expires, pass a TokenExpirationHandler to withAccessToken.
The handler should make a call to your backend, obtain a new access token, and then pass it back to the SDK by returning its value.
val tokenHandler = object : TokenExpirationHandler {
override fun onTokenExpired(): String? {
val newToken = "..." // get a new token from your backend
return newToken
}
}
Attention
onTokenExpiredis called on a non-UI thread.
Updated 3 days ago
Did this page help you?