Skip to main content

Interface: IAuthApi

Defined in: Extensions/ExtensionApiTypes.ts:678

Methods

openExternal()

openExternal(url): Promise<void>

Defined in: Extensions/ExtensionApiTypes.ts:700

Open the user's default browser at a URL (e.g. for a settings page on the extension's website). Requires network:oauth permission.

Parameters

url

string

Returns

Promise<void>


refreshOAuth()

refreshOAuth(opts): Promise<OAuthResult>

Defined in: Extensions/ExtensionApiTypes.ts:694

Exchange a refresh_token for a new access_token.

Parameters

opts

RefreshOAuthOpts

Returns

Promise<OAuthResult>


startOAuth()

startOAuth(opts): Promise<OAuthResult>

Defined in: Extensions/ExtensionApiTypes.ts:691

Run the OAuth 2.0 Authorization Code flow (with PKCE by default). The host opens a real BrowserWindow pointing at authorizeUrl, watches for navigation to the redirect URI, captures the code and state, performs the token exchange itself, and resolves with the result.

The redirect URI is always ext-ui://<extensionId>/<redirectPath>, registered with the auth provider. This means the host's custom protocol receives the redirect — no public callback server required.

Token storage is the extension's responsibility (use storage:secrets).

Parameters

opts

StartOAuthOpts

Returns

Promise<OAuthResult>