AuthMethodContextinterface
import { AuthMethodContext } from '@mortar-kit/auth'
interface AuthMethodContextWhat a sign-in method gets from createAuth for each request.
Properties
readonly returnTo: stringWhere to go after signing in: the request's
returnToparameter (a path on this site), or the admin.readonly sealer: SealerThe sealer over the app's secret: sign state, hash tokens.
url: (path?: "callback") => stringAbsolute URL of this method's routes:
url()is its start,url('callback')its callback.signInUrl: (params?: Record<string, string | undefined>) => stringAbsolute URL of the sign-in page with these search parameters (undefined ones left out).
allows: (identity: Identity) => Promise<boolean>Whether
identitymay sign in (runsauthorize), e.g. before sending an email.fail: (error: AuthError, params?: Record<string, string | undefined>) => ResponseBack to the sign-in page, showing
error, with these search parameters too (e.g. to keep a code form open).redirect: (location: string, cookies?: readonly string[]) => ResponseA 303 redirect to
location, setting these cookies.setCookie: (value: string, maxAge: number) => stringA Set-Cookie header storing
valuefor this method (its routes only) formaxAgeseconds.readCookie: () => string | undefinedThe value
setCookiestored, if the browser sent it back.