Token expiration handler

Configure expiration handler to refresh access tokens automatically.

Because of the limited lifespan of the accessToken, it is 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.