NestAuth
The part of a createAuth result the module uses. Any createAuth(...)
result fits, whatever its user type, session attributes or plugins.
Type Parameters
Section titled “Type Parameters”U extends AuthUser = AuthUser
Properties
Section titled “Properties”context
Section titled “context”
readonlycontext:object
readonlyclock:Clock
cookie?
Section titled “cookie?”
readonlyoptionalcookie?:SessionCookieConfig
The session cookie config. The CSRF, pre-session and blank session
cookies take their SameSite from it, per request Origin, exactly as
the session cookie does. Missing (a hand-made stand-in): Lax.
logger
Section titled “logger”
readonlylogger:object
logger.error()
Section titled “logger.error()”error(
message,context?):void
Parameters
Section titled “Parameters”message
Section titled “message”string
context?
Section titled “context?”Record<string, unknown>
Returns
Section titled “Returns”void
readonlyusers:object
users.findById()
Section titled “users.findById()”findById(
id):Promise<U|null>
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<U | null>
cookieName
Section titled “cookieName”
readonlycookieName:string
Methods
Section titled “Methods”flush()?
Section titled “flush()?”
optionalflush(options?):Promise<void>
Waits for background work (mail sends); the module calls it on shutdown, bounded.
Parameters
Section titled “Parameters”options?
Section titled “options?”timeout?
Section titled “timeout?”Duration
Returns
Section titled “Returns”Promise<void>
logout()
Section titled “logout()”logout(
input):Promise<{cookie:CookieSpec; }>
Parameters
Section titled “Parameters”RequestMeta
string | null | undefined
Returns
Section titled “Returns”Promise<{ cookie: CookieSpec; }>
readSessionToken()
Section titled “readSessionToken()”readSessionToken(
cookieHeader):string|null
Parameters
Section titled “Parameters”cookieHeader
Section titled “cookieHeader”string | null | undefined
Returns
Section titled “Returns”string | null
requireFreshAuth()
Section titled “requireFreshAuth()”requireFreshAuth(
session):AuthResult<void>
Parameters
Section titled “Parameters”session
Section titled “session”StoredSession<unknown>
Returns
Section titled “Returns”AuthResult<void>
validateRequest()
Section titled “validateRequest()”validateRequest(
input):Promise<AuthResult<ValidatedSession<unknown>>>
Parameters
Section titled “Parameters”RequestMeta
string | null | undefined
touch?
Section titled “touch?”boolean
Returns
Section titled “Returns”Promise<AuthResult<ValidatedSession<unknown>>>