Authinterface
import { Auth } from '@mortar-kit/auth'
interface Auth<User>Sign-in for the admin; see createAuth.
Properties
readonly methods: readonly AuthMethodInfo[]The methods, for the sign-in page.
readonly signInPath: stringThe sign-in page's path.
readonly basePath: stringWhere the auth routes live (
basePath), e.g./admin/auth.handle: (request: Request) => Promise<Response | null>Answers the auth routes (sign-in methods,
POST <basePath>/sign-out) and guardsprotected paths; null means carry on (the request is someone else's, or the user is signed in). Call it first in your middleware:return (await auth.handle(request)) ?? next();.user: (request: Request) => Promise<User | null>The signed-in user (
authorizeasked again), or null.require: (request: Request) => Promise<User>The signed-in user, or throws a 401 Response (403 for a cross-site POST). Call it first in every server function that writes: middleware can't tell which server-function calls are the admin's.