Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface DefaultBearerAuthHandlerOptions

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

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

Optional jwtOptions

jwtOptions: JWTVerifyOptions

Add options to the jsonwebtoken.verify call. Will only be used if you do not provide your own decodeToken function.

secret

secret: Secret

The private or public secret that will be passed to the jsonwebtoken.verify call. Will only be used if you do not provide your own decodeToken function.

strategy

strategy: "bearer"

uidKey

uidKey: string

The name of the key that contains the user id in the decoded token.

Optional unauthorized

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

Override the default unauthorized responding behaviour.

Generated using TypeDoc