Skip to content

@lastshotlabs/slingshot-oauth

npm install @lastshotlabs/slingshot-oauth

function buildConnectionClient(providerKey: string, config: ConnectionProviderConfig,): ConnectionOAuthClient

Source: packages/slingshot-oauth/src/connections.ts

Normalized OAuth client for a connection provider. Arctic’s per-provider classes differ in PKCE arity; this interface papers over that so the routes and the refresh helper stay provider-agnostic. createClient in the provider config is the escape hatch for providers arctic lacks.

function createConnectionsRouter(app: object, options: ConnectionsOptions, runtime: AuthRuntimeContext, postRedirect: string,): void

Source: packages/slingshot-oauth/src/connections.ts

Options for createOAuthPlugin.

All fields are optional - the plugin works out of the box with defaults.

function createOAuthPlugin(options?: OAuthPluginOptions): SlingshotPlugin

Source: packages/slingshot-oauth/src/plugin.ts

Builds a HookContext from a Hono context for use with auth lifecycle hooks.

Extracts the client IP, User-Agent, and requestId from the current request. When the IP is 'unknown' (e.g. behind a misconfigured proxy), it is omitted.

function createOAuthRouter(providers: string[], postLoginRedirect: string, runtime: AuthRuntimeContext, rateLimit?: import('@lastshotlabs/slingshot-auth').AuthRateLimitConfig,): void
FieldDescription
codeTOTP code, email OTP code, or recovery code.
methodVerification method to use.
passwordAccount password.
reauthTokenReauth challenge token (required for emailOtp and webauthn methods).
webauthnResponseWebAuthn assertion response (required for webauthn method).

Source: packages/slingshot-oauth/src/routes/oauth.ts

Normalized OAuth client for a connection provider. Arctic’s per-provider classes differ in PKCE arity; this interface papers over that so the routes and the refresh helper stay provider-agnostic. createClient in the provider config is the escape hatch for providers arctic lacks.

async function getConnectionAccessToken(app: object, userId: string, provider: string,): Promise<ConnectionAccessToken | null>

Source: packages/slingshot-oauth/src/connections.ts

Normalized OAuth client for a connection provider. Arctic’s per-provider classes differ in PKCE arity; this interface papers over that so the routes and the refresh helper stay provider-agnostic. createClient in the provider config is the escape hatch for providers arctic lacks.

async function getProviderConnection(app: object, userId: string, provider: string,): Promise<ProviderConnectionSummary | null>

Source: packages/slingshot-oauth/src/connections.ts

Source: packages/slingshot-oauth/src/plugin.ts

Verify a Sign in with Apple identity token before trusting identity claims.

Arctic’s decodeIdToken() only parses the JWT. Apple requires signature, algorithm, issuer, audience, expiry, issued-at, subject, and nonce validation.

async function verifyAppleIdentityToken(idToken: string, clientId: string, expectedNonce: string, key: AppleVerificationKey = appleJwks,): Promise<AppleIdentityClaims>

Source: packages/slingshot-oauth/src/lib/appleIdentityToken.ts

Source: packages/slingshot-oauth/src/lib/appleIdentityToken.ts

Normalized OAuth client for a connection provider. Arctic’s per-provider classes differ in PKCE arity; this interface papers over that so the routes and the refresh helper stay provider-agnostic. createClient in the provider config is the escape hatch for providers arctic lacks.

Source: packages/slingshot-oauth/src/connections.ts

Normalized OAuth client for a connection provider. Arctic’s per-provider classes differ in PKCE arity; this interface papers over that so the routes and the refresh helper stay provider-agnostic. createClient in the provider config is the escape hatch for providers arctic lacks.

Source: packages/slingshot-oauth/src/connections.ts

Source: packages/slingshot-oauth/src/connections.ts

Source: packages/slingshot-oauth/src/connections.ts

Normalized OAuth client for a connection provider. Arctic’s per-provider classes differ in PKCE arity; this interface papers over that so the routes and the refresh helper stay provider-agnostic. createClient in the provider config is the escape hatch for providers arctic lacks.

Source: packages/slingshot-oauth/src/connections.ts

Options for createOAuthPlugin.

All fields are optional - the plugin works out of the box with defaults.

Source: packages/slingshot-oauth/src/plugin.ts

Options for createOAuthPlugin.

All fields are optional - the plugin works out of the box with defaults.

Source: packages/slingshot-oauth/src/plugin.ts