Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/jose/jwt/unsecured.ts>UnsecuredJWT

"JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes.
Extremely Popular
Go to Latest
class UnsecuredJWT
extends ProduceJWT
import { UnsecuredJWT } from "https://deno.land/x/jose@v4.13.0/jwt/unsecured.ts";

The UnsecuredJWT class is a utility for dealing with { "alg": "none" } Unsecured JWTs.

Examples

Encoding

const unsecuredJwt = new jose.UnsecuredJWT({ 'urn:example:claim': true })
  .setIssuedAt()
  .setIssuer('urn:example:issuer')
  .setAudience('urn:example:audience')
  .setExpirationTime('2h')
  .encode()

console.log(unsecuredJwt)

Decoding

const payload = jose.UnsecuredJWT.decode(jwt, {
  issuer: 'urn:example:issuer',
  audience: 'urn:example:audience',
})

console.log(payload)

Methods

encode(): string

Encodes the Unsecured JWT.

Static Methods

Decodes an unsecured JWT.