Skip to main content

Function: getToken

jwt.getToken

â–¸ getToken<R>(params): Promise<R extends true ? string : JWT | null>

Takes a NextAuth.js request (req) and returns either the NextAuth.js issued JWT's payload, or the raw JWT string. We look for the JWT in the either the cookies, or the Authorization header. Documentation

Type parameters​

NameType
Rextends boolean = false

Parameters​

NameType
paramsGetTokenParams<R>

Returns​

Promise<R extends true ? string : JWT | null>