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.
Methods
Section titled “Methods”connect()
Section titled “connect()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider? |
string |
Returns
Section titled “Returns”Promise<void>
connections()
Section titled “connections()”connections(
provider?):Promise<OAuthConnection[]>
Every connection to the service, oldest first.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
provider? |
string |
Returns
Section titled “Returns”Promise<OAuthConnection[]>
describe()
Section titled “describe()”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).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
connection |
string |
who |
{ account: string; label: string; } |
who.account |
string |
who.label? |
string |
provider? |
string |
Returns
Section titled “Returns”Promise<OAuthConnection>
disconnect()
Section titled “disconnect()”disconnect(
connection?,provider?):Promise<void>
Signs out of one connection, or all of them: revoked where the service allows.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
connection? |
string |
provider? |
string |
Returns
Section titled “Returns”Promise<void>
invalidate()
Section titled “invalidate()”invalidate(
connection,provider?):Promise<void>
The service rejected this connection’s token (revoked on the web): it needs signing in again.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
connection |
string |
provider? |
string |
Returns
Section titled “Returns”Promise<void>
token()
Section titled “token()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
{ connection?: string; provider?: string; } |
options.connection? |
string |
options.provider? |
string |
Returns
Section titled “Returns”Promise<{ accessToken: string; connection: OAuthConnection; } | undefined>