Other Auth Api Error Body Auth
Api
Error
Body
: { error
: ErrorMessage ; platform
: undefined | string } Type declaration platform: undefined | string Auth Api Response Body Auth Api Response Body: { platform: string ; token: string }
Type declaration platform: string token: string Auth Configs Auth
Configs
: { apiRoot
?: string ; basicAuth
?: { appIconUrl
?: string ; appName
?: string ; codeMessageComponent
?: CodeMessageComponent ; loginDuration
?: number ; maxLoginAttempt
?: number ; mode
?: "loose" | "strict" ; verifyCodeDigits
?: number } ; cookieDomain
?: string ; cookiePath
?: string ; cookieSameSite
?: "strict" | "lax" | "none" ; dataCookieMaxAge
?: number ; redirectRoot
?: string ; refreshDuration
?: number ; secret
: string ; secure
?: boolean ; serverUrl
: string ; tokenLifetime
?: number } Type declaration Optional api Root?: string Optional basic Auth?: { appIconUrl?: string ; appName?: string ; codeMessageComponent?: CodeMessageComponent ; loginDuration?: number ; maxLoginAttempt?: number ; mode?: "loose" | "strict" ; verifyCodeDigits?: number } Optional app Icon Url?: string Optional app Name?: string Optional login Duration?: number Optional max Login Attempt?: number Optional mode?: "loose" | "strict" Optional verify Code Digits?: number Optional cookie Domain?: string Optional cookie Path?: string Optional cookie Same Site?: "strict" | "lax" | "none" Optional data Cookie Max Age?: number Optional redirect Root?: string Optional refresh Duration?: number secret: string Optional secure?: boolean server Url: string Optional token Lifetime?: number Auth Context Auth
Context
< User , Channel > : { channel
: Channel ; platform
: string ; user
: User } & AuthContextBase Type parameters Auth Context Base Auth Context Base: { expireAt: Date ; loginAt: Date }
Type declaration expire At: Date login At: Date Auth Payload Auth Payload< Data > : { data: Data ; init: number ; platform: string ; scope: { domain?: string ; path: string } }
Type parameters Type declaration data: Data init: number platform: string scope: { domain?: string ; path: string } Optional domain?: string path: string Auth Token Payload Type parameters Authenticator Credential Result Authenticator Credential Result< Credential > : { credential: Credential ; ok: true } | ErrorResult
Type parameters Check Data Result Check
Data
Result
< Context > : { contextDetails
: ContextDetails < Context > ; ok
: true } | ErrorResult Type parameters Context Details Context Details< Context > : Omit < Context , "platform" | "loginAt" | "expireAt" >
Type parameters Context Of Authenticator Context
Of
Authenticator
< Authenticator > : Authenticator extends ServerAuthenticator < unknown , unknown , infer Context
> ? Context : Authenticator extends ClientAuthenticator < unknown , unknown , infer Context
> ? Context : never Type parameters Error Message Error Message: { code: number ; reason: string }
Type declaration code: number reason: string Error Payload Error
Payload
: { error
: ErrorMessage ; platform
: string ; scope
: { domain
?: string ; path
: string } } Type declaration platform: string scope: { domain?: string ; path: string } Optional domain?: string path: string Refresh Request Body Refresh Request Body: { token: string }
Sign Request Body Sign Request Body< Credential > : { credential: Credential ; platform: string }
Type parameters Type declaration credential: Credential platform: string State Payload State Payload< State > : { platform: string ; state: State }
Type parameters Type declaration platform: string state: State State Token Payload Type parameters User Of Authenticator Type parameters Verify Request Body Verify Request Body: { token: string }
Verify Result Verify Result< Data > : { data: Data ; ok: true } | ErrorResult
Type parameters With Headers With Headers: { headers: IncomingHttpHeaders }
Type declaration headers: IncomingHttpHeaders
Auth Module
This package is the underlying auth module of webview platform. You might want to use
@sociably/webview
unless you want to serve your own web service.Install
Docs
Check the package reference.
Setup
Here is a simple example to protect your API with auth module:
Back-end
Front-end