← @mortar-kit/auth

AuthMethodinterface

import { AuthMethod } from '@mortar-kit/auth'

interface AuthMethod

A way to sign in. createAuth routes POST <basePath>/<id> to start and <basePath>/<id>/callback (GET or POST) to callback.

Properties

id: string

URL segment and Identity.method: lowercase letters, digits and dashes.

label: string

Button text on the sign-in page.

input: "button" | "email"

What the sign-in page shows for it; see AuthMethodInfo.input.

start: (request: Request, ctx: AuthMethodContext) => Promise<Response>

The sign-in form was submitted: redirect to the provider, send an email, …

callback: (request: Request, ctx: AuthMethodContext) => Promise<Response | AuthSuccess>

The provider (or an emailed link or code) came back: who is it? A Response instead answers the request as it is (e.g. ctx.fail).