Skip to content

zero-auth API Documentation v1.6.0


zero-auth API Documentation / decodeToken

Function: decodeToken() ​

decodeToken(token): AuthUser

Defined in: packages/zero-auth/src/core/decode.ts:17

Decodes a JWT without verifying the signature.

⚠️ Warning: This function does NOT validate the token. The returned payload may be from a tampered or expired token. Only use this when you intentionally need to inspect a token without verification (e.g., reading the exp claim before a refresh).

Parameters ​

token ​

string

The compact JWT string to decode.

Returns ​

AuthUser

The decoded payload as AuthUser.

Throws ​

with AUTH_TOKEN_INVALID if the token is malformed.