Skip to content

zero-auth API Documentation v1.6.0


zero-auth API Documentation / verifyToken

Function: verifyToken() ​

verifyToken(token, keyOrSecret, options?): Promise<AuthUser>

Defined in: packages/zero-auth/src/core/verify.ts:22

Verifies a JWT and returns the decoded payload.

Parameters ​

token ​

string

The compact JWT string to verify.

keyOrSecret ​

string | VerificationKey

Verification public key PEM, secret string, Uint8Array, KeyLike, or JWKS resolver.

options? ​

VerifyTokenOptions

Optional issuer, audience, clockTolerance, and algorithm options.

Returns ​

Promise<AuthUser>

The decoded AuthUser payload.

Throws ​

with the appropriate code on any verification failure.