refreshOAuthToken

api.refreshOAuthToken() Exchanges the stored refresh token for a fresh access token. Throws if the user has not authorized the addon or if the refresh token has been revoked. In that case, call authorizeOAuth() to re-authorize the user.

Return value - Promise<TokenResponse>

const api = window.Addon.iframe();

try {
  const tokenResponse = await api.refreshOAuthToken();
  // tokenResponse.access_token holds a fresh access token
} catch (err) {
  // Refresh token missing or revoked.
  // Call api.authorizeOAuth() to re-authorize the user.
}
logo
Kaiten
If you have any questions or need help with integration feel free to write us at support@kaiten.ru