getOAuthAccessToken

api.getOAuthAccessToken() Resolves with { access_token, expires_at } if the user has already authorized the addon (the SDK proactively refreshes a token that is about to expire). Throws if no token is available — catch the error to decide whether to render an "Authorize" button or start the flow.

Return value - Promise<TokenResponse>

const api = window.Addon.iframe();

try {
  // Resolves with { access_token, expires_at } if the addon is authorized.
  const { access_token } = await api.getOAuthAccessToken();
  // Use access_token for authenticated requests.
} catch {
  // Throws when there is no token yet — start the flow.
  await api.authorizeOAuth();
}
logo
FlowFast
If you have any questions or need help with integration feel free to write us at support@flowfast.io