AuthProvider
interfaceAn authentication provider a mod contributes, as returned by authProvider.
Import
import { AuthProvider } from '@modular/sdk';Members6
- createSession
(scopes: readonly string[], options: AuthProviderSessionOptions, ctx: AuthProviderContext) => Promise<AuthenticationSession>Run the interactive sign-in and return the new session. Only called when AuthProvider.getSessions came back empty and the caller asked for `createIfNone`. This is where prompting and browser redirects belong. Store the token in `ctx.secrets` before returning.
- getSessions
(scopes: readonly string[] | undefined, options: AuthProviderSessionOptions, ctx: AuthProviderContext) => Promise<readonly AuthenticationSession[]>Return sessions already signed in, without any user interaction. Called first on every lookup. Return an empty array when there is nothing stored. Do not sign the user in from here.
- id
stringProvider id callers pass to `ctx.auth.getSession`.
- kind
'auth-provider'- label
stringName of the service as the user sees it, for example `GitHub`.
- removeSession
(sessionId: string, ctx: AuthProviderContext) => Promise<void>Sign out. Delete the stored credential and revoke it if the service allows.
Notes
- category
- Authoring