Skip to content

OAuth

Sign-in, run by the app: OAuth 2.0 with PKCE and a loopback redirect, tokens in the Keychain, refreshed for you. provider may be left out when the manifest declares just one. See “The app: sign-in” in the integration kit guide.

connect(provider?): Promise<void>

Opens the service’s sign-in page in the browser, and resolves once it’s open: the person takes as long as they need. When they’re done, the app says so under the notch and runs update(). Rejects when it can’t start (the sign-in port is taken).

Parameter Type
provider? string

Promise<void>


connections(provider?): Promise<OAuthConnection[]>

Every connection to the service, oldest first.

Parameter Type
provider? string

Promise<OAuthConnection[]>


describe(connection, who, provider?): Promise<OAuthConnection>

Says who a connection is, once you’ve asked the service: an account id and a name. Connecting the same account again replaces the older connection, so resolves with the one that stays (its id may differ).

Parameter Type
connection string
who { account: string; label: string; }
who.account string
who.label? string
provider? string

Promise<OAuthConnection>


disconnect(connection?, provider?): Promise<void>

Signs out of one connection, or all of them: revoked where the service allows.

Parameter Type
connection? string
provider? string

Promise<void>


invalidate(connection, provider?): Promise<void>

The service rejected this connection’s token (revoked on the web): it needs signing in again.

Parameter Type
connection string
provider? string

Promise<void>


token(options?): Promise<{ accessToken: string; connection: OAuthConnection; } | undefined>

A fresh access token for a connection (or the first that works), renewed first when it’s about to expire. Undefined when there’s none that works: offer Connect. Rejects when an expired token couldn’t be renewed for want of the network: that’s offline, not signed out.

Parameter Type
options? { connection?: string; provider?: string; }
options.connection? string
options.provider? string

Promise<{ accessToken: string; connection: OAuthConnection; } | undefined>