Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CustomBearerAuthHandlerOptions

Hierarchy

Indexable

[key: string]: any

Index

Properties

Optional allowAnonymous

allowAnonymous: undefined | false | true

Enable if unauthorized access should still be possible and the middleware should populate the request with user information.

Optional anonymousUserValue

anonymousUserValue: any | null

If anonymous access is allowed, this value will be passed to req.user, defaults to null.

Optional catch

decodeToken

decodeToken: (token: string) => Promise<UserId> | UserId

Provide your own token decode function. Must return the user id contained in the token.

Type declaration

getUser

getUser: (userId: UserId) => Promise<UserInfo> | UserInfo

Provide a function that returns a user by its id.

Type declaration

Optional headerName

headerName: undefined | string

Authorization header name, defaults to Authorization

strategy

strategy: "bearer"

Optional unauthorized

unauthorized: undefined | ((req: PossiblyAuthedNextApiRequest, res: NextApiResponse) => Promise<void> | void)

Override the default unauthorized responding behaviour.

Generated using TypeDoc