Because of the limited lifespan of the accessToken
, it's important to handle the situation correctly when the token expires and needs to be refreshed. To do this, provide tokenHandler
for the SDK Builder.
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 = .... return newToken }}
TokenExpirationHandler tokenUpdater = () -> { String newAccessToken = "..."; return newAccessToken; };
🚧
Attention
onTokenExpired
is called on a non-UI thread.
Updated 3 months ago