api.authorizeOAuth(options?) Initiates the OAuth flow that lets the addon call the public REST API on behalf of the current user. Shows a consent dialog; on approval, the SDK returns a TokenResponse with a fresh access token and its expiration. After the first authorization, the same user does not need to re-consent — the addon can fetch tokens via getOAuthAccessToken().
| argument | Type | Description |
|---|---|---|
| options | object | Optional. Reserved for future use — currently ignored by the platform. |
Return value - Promise<TokenResponse>
// Inside an addon iframe
const api = window.Addon.iframe();
const button = {
text: 'Connect to platform API',
callback: async () => {
// Resolves with { access_token, expires_at } after the user grants consent.
const { access_token, expires_at } = await api.authorizeOAuth();
console.log('Authorized, expires at:', expires_at);
},
};