Back to Jose

Function: decodeJwt()

docs/util/decode_jwt/functions/decodeJwt.md

6.2.121.4 KB
Original Source

Function: decodeJwt()

šŸ’— Help the project

Support from the community to continue maintaining and improving this module is welcome. If you find the module useful, please consider supporting the project by becoming a sponsor.

ā–ø decodeJwt<PayloadType>(jwt): PayloadType & JWTPayload

Decodes the Claims Set of a JWT in Compact JWS serialization without checking its signature or validating claim types and values.

Use jwtVerify to verify signed JWTs or jwtDecrypt to decrypt and validate encrypted JWTs.

This function is exported (as a named export) from the main 'jose' module entry point as well as from its subpath export 'jose/jwt/decode'.

Type Parameters

Type ParameterDefault typeDescription
PayloadTypeJWTPayloadType definition of the JWT Claims Set the token is expected to carry.

Parameters

ParameterTypeDescription
jwtstringJWT token in compact JWS serialization.

Returns

PayloadType & JWTPayload

The parsed JWT Claims Set.

Example

js
const claims = jose.decodeJwt(token)
console.log(claims)