renewTokens

abstract fun renewTokens(expiredAccessToken: String?, refreshToken: String?, complete: RenewTokensCallback)

Called when an access token is missing or expired that must be renewed via the backend.

Parameters

expiredAccessToken

The user's expired access token.

refreshToken

The user's refresh token for the expired access token.

complete

The completion handler to be called with the new access and refresh tokens on success or nil if it fails.

This method will be called when an access token is missing or expired and needs renewing via the backend. The SDK will first attempt automatic renewal of tokens via the frontend, but if this fails because the refresh token is missing, revoked or of some other error, a backend renewal will be required. Backend renewals require proxying the request through your own backend api to Younify using your private api key. The complete callback must be called with the new tokens or nil if an error occurs. As a convenience, renewedTokens will be called afterward on success to persist the new tokens in device storage.