addOnTokenRefreshCallback

Receive a callback when the bearer token refreshes.

You can add a callback method that will be called each time the bearer token is refreshed. This can only be used while using the Venly Connect JS authentication client. This function has one parameter: a callback function accepting one parameter (the new bearer token) and returning void.

venlyConnect.addOnTokenRefreshCallback(token => {
  console.log('Refreshed bearer token: ' + token);
});

Signature:

venlyConnect.addOnTokenRefreshCallback(tokenRefreshCallback: (token: string) => void): void

Returns:

Promise<AuthenticationResult>

Parameters:

ParameterDescription
tokenRefreshCallbacka callback function accepting one parameter (the new bearer token) and returning void. (Required)

Example:

venlyConnect.addOnTokenRefreshCallback(token => {
  console.log('Refreshed bearer token: ' + token);
});

Object Types

📘