Skip to Content
API ReferenceServerFunctionsFunction: verifyAccessToken()

@authgear/nextjs


@authgear/nextjs / server / verifyAccessToken

Function: verifyAccessToken()

verifyAccessToken(token, config): Promise<JWTPayload>

Defined in: src/server.ts:129 

Verify a JWT access token (from Authorization: Bearer header). Useful for protecting API routes.

Parameters

token

string

config

AuthgearConfig

Returns

Promise<JWTPayload>

Throws

If the token is invalid, expired, or has wrong issuer/audience

Last updated on