跳到主要内容

Interface: KernelAuthApi

Defined in: packages/plugin-sdk/src/kernel/auth.ts:33

Methods​

connect()​

connect(serviceId, opts?): Promise<KernelAuthConnectResult>

Defined in: packages/plugin-sdk/src/kernel/auth.ts:45

Start (or reuse) a connection. Already-connected services resolve immediately to {status:'connected'}. A new connection lands in pending with an authorizationUrl the user opens in a browser; the host flips it to connected after the OAuth callback and emits plugin.auth.connected (subscribe via api.events.subscribe).

Parameters​

serviceId​

string

opts?​
scopes?​

string[]

Returns​

Promise<KernelAuthConnectResult>


get()​

get(connectionId): Promise<KernelAuthConnection | null>

Defined in: packages/plugin-sdk/src/kernel/auth.ts:37

One connection by id; null when absent or not owned by the plugin.

Parameters​

connectionId​

string

Returns​

Promise<KernelAuthConnection | null>


list()​

list(): Promise<KernelAuthConnection[]>

Defined in: packages/plugin-sdk/src/kernel/auth.ts:35

All connections of this plugin (metadata only, never tokens).

Returns​

Promise<KernelAuthConnection[]>


revoke()​

revoke(connectionId): Promise<{ ok: true; }>

Defined in: packages/plugin-sdk/src/kernel/auth.ts:47

Revoke a connection; the server forgets the token and emits the event.

Parameters​

connectionId​

string

Returns​

Promise<{ ok: true; }>