Called when an access token is missing or expired that must be renewed via the backend.
The user's expired access token.
The user's refresh token for the expired access token.
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 renewed completion handler must be called with the new tokens or null if an error occurs. As a convenience, onRenewed will be called afterward on success to persist the new tokens in device storage.
Called when an access token and refresh token are renewed and need persisted.
The user's newly acquired access token.
The user's newly acquired refresh token.
This method will be called when an access token and refresh token have been renewed and need persisted. The listener should persisted the new tokens in device local storage in a non-cloud-synchronized manner. If the tokens are accidentally shared between multiple devices, frontend renewal on one device may cause the other devices to be logged out triggering a backend renewal request via onRenew.
Token handler.
Implement this handler to receive token events from the sdk and to handle backend token renewals. The instance can be set in ConnectOptions.