# JavaScript JWT libraries

JavaScript JWT libraries create and verify JSON Web Tokens, the signed tokens that carry identity claims between services. A server checks each token's signature and claims, such as its issuer, audience, and expiry, before it trusts the payload. These libraries handle the login sessions, API authentication, and single sign-on in web apps and backend services.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [jose](#jose) | 878.5M | 7.9K | Nov 2026 | MIT |
| [jsonwebtoken](#jsonwebtoken) | 317.9M | 18.2K | Dec 2025 | MIT |
| [Passport JWT](#passport-jwt) | 21.8M | 2.0K | Dec 2022 | MIT |
| [AWS JWT Verify](#aws-jwt-verify) | 10.3M | 751 | Jun 2026 | Apache-2.0 |
| [fast-jwt](#fast-jwt) | 7.3M | 440 | Nov 2026 | Apache-2.0 |
| [Fastify JWT](#fastify-jwt) | 5.3M | 588 | Nov 2026 | MIT |
| [express-jwt](#express-jwt) | 4.4M | 4.5K | Dec 2024 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[jose](#jose) has the most monthly downloads in this comparison, at 878.5M.

## Capabilities

| Library | JWT signing | Browser-native verification |
| --- | --- | --- |
| [jose](#jose) | Yes | Yes |
| [jsonwebtoken](#jsonwebtoken) | Yes | No |
| [Passport JWT](#passport-jwt) | No | No |
| [AWS JWT Verify](#aws-jwt-verify) | No | Yes |
| [fast-jwt](#fast-jwt) | Yes | No |
| [Fastify JWT](#fastify-jwt) | Yes | No |
| [express-jwt](#express-jwt) | No | No |

## Libraries

### jose

[GitHub](https://github.com/panva/jose) · [npm](https://www.npmjs.com/package/jose) · [Docs](https://raw.githubusercontent.com/panva/jose/main/README.md)

Signs, verifies, encrypts, and decrypts tokens across web-compatible JavaScript runtimes.

- Downloads / mo: 878.5M
- Stars: 7.9K
- Last release: 6.2.18
- License: MIT
- Capabilities: [From the jose docs](https://raw.githubusercontent.com/panva/jose/main/README.md)

**Strengths**

- **Supports encrypted token payloads.** Use EncryptJWT and jwtDecrypt for encrypted JWT workflows.
- **Loads remote verification key sets.** createRemoteJWKSet fetches and caches keys from an HTTP endpoint.

**Watch out for**

- **Algorithm availability varies by runtime.** Check the chosen algorithm against the target runtime.
- **CommonJS needs compatible Node support.** Use ESM or Node with require(esm) enabled.

```sh
npm install jose@6.2.18
```

**nextauthjs/next-auth** (28.4K stars)

[nextauthjs/next-auth](https://github.com/nextauthjs/next-auth) 

```typescript
export async function encode<Payload = JWT>(params: JWTEncodeParams<Payload>) {
  const { token = {}, secret, maxAge = DEFAULT_MAX_AGE, salt } = params
  const secrets = Array.isArray(secret) ? secret : [secret]
  const encryptionSecret = await getDerivedEncryptionKey(enc, secrets[0], salt)

  const thumbprint = await calculateJwkThumbprint(
    { kty: "oct", k: base64url.encode(encryptionSecret) },
    `sha${encryptionSecret.byteLength << 3}` as Digest
  )
  // @ts-expect-error `jose` allows any object as payload.
  return await new EncryptJWT(token)
    .setProtectedHeader({ alg, enc, kid: thumbprint })
    .setIssuedAt()
    .setExpirationTime(now() + maxAge)
    .setJti(crypto.randomUUID())
    .encrypt(encryptionSecret)
}

```

[packages/core/src/jwt.ts](https://github.com/nextauthjs/next-auth/blob/a1a16a5a7780488c7449feece410033f445d0b31/packages/core/src/jwt.ts#L57) · [More projects using jose →](https://dashboard.exa.ai/playground/search?q=JavaScript%20application%20code%20using%20jose%20for%20token%20signing%2C%20signature%20verification%2C%20encryption%20and%20key%20selection&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import { SignJWT, jwtVerify } from "jose";
const key = crypto.getRandomValues(new Uint8Array(32));
const token = await new SignJWT({ sub: "user-1" }).setProtectedHeader({ alg: "HS256" }).setExpirationTime("5m").sign(key);
const { payload } = await jwtVerify(token, key, { algorithms: ["HS256"] });
console.log(payload.sub);

```

From [SignJWT.md](https://raw.githubusercontent.com/panva/jose/main/README.md)

### jsonwebtoken

[GitHub](https://github.com/auth0/node-jsonwebtoken) · [npm](https://www.npmjs.com/package/jsonwebtoken) · [Docs](https://raw.githubusercontent.com/auth0/node-jsonwebtoken/master/README.md)

Signs JWTs and verifies signatures and configured token claims in Node.js.

- Downloads / mo: 317.9M
- Stars: 18.2K
- Last release: 9.0.3
- License: MIT
- Capabilities: [From the jsonwebtoken docs](https://raw.githubusercontent.com/auth0/node-jsonwebtoken/master/README.md)

**Strengths**

- **Supports synchronous and callback verification.** Choose immediate results or callback-based verification.
- **Checks the intended token audience.** Set audience and issuer during verification.

**Watch out for**

- **Tokens need an explicit expiry.** Set expiresIn or exp when tokens must expire.
- **Decoding alone skips signature verification.** Use verify to validate an incoming token.

```sh
npm install jsonwebtoken@9.0.3
```

**colibri-hq/colibri** (270 stars)

[colibri-hq/colibri](https://github.com/colibri-hq/colibri) 

```typescript
export function verifyToken(token: string) {
  if (!token) {
    throw new Error("Missing or invalid access token");
  }

  const { payload } = jwt.verify(token, env.JWT_SECRET, { complete: true });

  if (typeof payload === "string") {
    throw new Error("Unexpected token payload");
  }

  return payload as AccessTokenPayload;
}

```

[apps/app/src/lib/server/auth.ts](https://github.com/colibri-hq/colibri/blob/2a282d3e9d02a8c62e0681d160d8c9c17d0dabbe/apps/app/src/lib/server/auth.ts#L34) · [More projects using jsonwebtoken →](https://dashboard.exa.ai/playground/search?q=JavaScript%20application%20code%20using%20jsonwebtoken%20for%20token%20signing%2C%20signature%20verification%2C%20encryption%20and%20key%20selection&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
const jwt = require("jsonwebtoken");
const { randomBytes } = require("node:crypto");
const key = randomBytes(32);
const token = jwt.sign({ sub: "user-1" }, key, { algorithm: "HS256", expiresIn: "5m" });
console.log(jwt.verify(token, key, { algorithms: ["HS256"] }));

```

From [README.md](https://raw.githubusercontent.com/auth0/node-jsonwebtoken/master/README.md)

### Passport JWT

[GitHub](https://github.com/mikenicholson/passport-jwt) · [npm](https://www.npmjs.com/package/passport-jwt) · [Docs](https://raw.githubusercontent.com/mikenicholson/passport-jwt/master/README.md)

Authenticates endpoints through Passport with a JSON Web Token instead of a session.

- Downloads / mo: 21.8M
- Stars: 2.0K
- Last release: 4.0.1
- License: MIT
- Capabilities: [From the Passport JWT docs](https://raw.githubusercontent.com/mikenicholson/passport-jwt/master/README.md)

**Strengths**

- **Session-free REST endpoints.** Each request carries its own token rather than a server session.

**Watch out for**

- **Token extraction is required.** The jwtFromRequest option must name where each request carries its token.

```sh
npm install passport-jwt@4.0.1 passport express
```

**hoppscotch/hoppscotch** (80.8K stars)

[hoppscotch/hoppscotch](https://github.com/hoppscotch/hoppscotch) 

```javascript
constructor(
    private usersService: UserService,
    private configService: ConfigService,
  ) {
    super({
      jwtFromRequest: ExtractJwt.fromExtractors([
        (request: Request) =>
          pipe(
            extractToken(request),
            E.fold(
              (error) => {
                throw error;
              },
              (token) => {
                return token;
              },
            ),
          ),
      ]),
      secretOrKey: configService.get('INFRA.JWT_SECRET'),
    });
  }

```

[packages/hoppscotch-backend/src/auth/strategies/jwt.strategy.ts](https://github.com/hoppscotch/hoppscotch/blob/55908a76a1d0555c9bbb5d74244c14173df95b06/packages/hoppscotch-backend/src/auth/strategies/jwt.strategy.ts#L91) · [More projects using Passport JWT →](https://dashboard.exa.ai/playground/search?q=passport-jwt%20GitHub%20projects)

**Quickstart**

```javascript
const express = require("express");
const passport = require("passport");
const { Strategy, ExtractJwt } = require("passport-jwt");
const secret = process.env.JWT_SECRET;
if (!secret) throw new Error("Set JWT_SECRET to the issuer shared key");
passport.use(new Strategy({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), secretOrKey: secret, algorithms: ["HS256"] }, (claims, done) => done(null, claims)));
const app = express();
app.use(passport.initialize());
app.get("/me", passport.authenticate("jwt", { session: false }), (req, res) => res.json(req.user));
app.listen(3000);

```

From [README.md](https://raw.githubusercontent.com/mikenicholson/passport-jwt/master/README.md)

### AWS JWT Verify

[GitHub](https://github.com/awslabs/aws-jwt-verify) · [npm](https://www.npmjs.com/package/aws-jwt-verify) · [Docs](https://raw.githubusercontent.com/awslabs/aws-jwt-verify/main/README.md)

Verifies JWTs signed by Amazon Cognito, Application Load Balancer, or any OIDC-compatible identity provider.

- Downloads / mo: 10.3M
- Stars: 751
- Last release: 5.2.1
- License: Apache-2.0
- Capabilities: [From the AWS JWT Verify docs](https://raw.githubusercontent.com/awslabs/aws-jwt-verify/main/README.md)

**Strengths**

- **Runs in browsers too.** The verifier works in web browsers as well as Node.js.

**Watch out for**

- **Verifies tokens only.** It checks tokens that an identity provider issued rather than signing new ones.

```sh
npm install aws-jwt-verify@5.2.1
```

**getclawe/clawe** (751 stars)

[getclawe/clawe](https://github.com/getclawe/clawe) 

```javascript
async function verifyCognitoToken(
  token: string,
): Promise<VerifiedToken | null> {
  try {
    const payload = await getCognitoVerifier().verify(token);
    if (!isVerifiedToken(payload)) return null;
    return payload;
  } catch {
    return null;
  }
}

```

[apps/web/src/lib/auth/verify-token.ts](https://github.com/getclawe/clawe/blob/3214feda034b8a4924b4fb11c17c5129f099658c/apps/web/src/lib/auth/verify-token.ts#L43) · [More projects using AWS JWT Verify →](https://dashboard.exa.ai/playground/search?q=aws-jwt-verify%20GitHub%20projects)

**Quickstart**

```javascript
import { CognitoJwtVerifier } from "aws-jwt-verify";
const verifier = CognitoJwtVerifier.create({ userPoolId: "us-east-1_EXAMPLE", tokenUse: "id", clientId: "YOUR_APP_CLIENT_ID" });
const claims = await verifier.verify("YOUR_ID_TOKEN");
console.log(claims.sub);

```

From [README.md](https://raw.githubusercontent.com/awslabs/aws-jwt-verify/main/README.md)

### fast-jwt

[GitHub](https://github.com/nearform/fast-jwt) · [npm](https://www.npmjs.com/package/fast-jwt) · [Docs](https://raw.githubusercontent.com/nearform/fast-jwt/master/README.md)

Builds reusable JWT signer, decoder, and verifier functions with optional verification caching.

- Downloads / mo: 7.3M
- Stars: 440
- Last release: 6.3.7
- License: Apache-2.0
- Capabilities: [From the fast-jwt docs](https://raw.githubusercontent.com/nearform/fast-jwt/master/README.md)

**Strengths**

- **Reuses configured verifier functions.** Create a verifier once and pass tokens to it.
- **Caches verified tokens optionally.** Enable cache to reuse prior verification results.

**Watch out for**

- **Allowed algorithms need explicit restriction.** Set algorithms to the expected signing algorithms.
- **Required claims need explicit configuration.** Set requiredClaims for fields every token must contain.

```sh
npm install fast-jwt@6.3.7
```

**fastify/fastify-jwt** (588 stars)

[fastify/fastify-jwt](https://github.com/fastify/fastify-jwt) 

```typescript
function getVerifier (options, globalOptions) {
    const useGlobalOptions = globalOptions ?? options === verifierConfig.options
    // Use global verifier if using global options with static key
    if (useGlobalOptions && hasStaticPublicKey) return verifier
    // Only cache verifier when using default options (except for key)
    if (useGlobalOptions && options.key && typeof options.key === 'string') {
      let verifier = validatorCache.get(options.key)
      if (!verifier) {
        verifier = createVerifier(options)
        validatorCache.set(options.key, verifier)
      }
      return verifier
    }
    return createVerifier(options)
  }

```

[index.js](https://github.com/fastify/fastify-jwt/blob/fbf0f92b9c5319508c0f3dccedc00cee563d9ebf/index.js#L267) · [More projects using fast-jwt →](https://dashboard.exa.ai/playground/search?q=JavaScript%20application%20code%20using%20fast-jwt%20for%20token%20signing%2C%20signature%20verification%2C%20encryption%20and%20key%20selection&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
const { createSigner, createVerifier } = require("fast-jwt");
const { randomBytes } = require("node:crypto");
const key = randomBytes(32);
const sign = createSigner({ key, algorithm: "HS256", expiresIn: "5m" });
const verify = createVerifier({ key, algorithms: ["HS256"] });
console.log(verify(sign({ sub: "user-1" })));

```

From [README.md](https://raw.githubusercontent.com/nearform/fast-jwt/master/README.md)

### Fastify JWT

[GitHub](https://github.com/fastify/fastify-jwt) · [npm](https://www.npmjs.com/package/@fastify/jwt) · [Docs](https://raw.githubusercontent.com/fastify/fastify-jwt/main/README.md)

Adds sign, verify, and decode to a Fastify server, built on fast-jwt.

- Downloads / mo: 5.3M
- Stars: 588
- Last release: 10.2.8
- License: MIT
- Capabilities: [From the Fastify JWT docs](https://raw.githubusercontent.com/fastify/fastify-jwt/main/README.md)

**Strengths**

- **Request and reply helpers.** The plugin registers request.jwtVerify and reply.jwtSign for route handlers.

**Watch out for**

- **Secret required at registration.** Registering the plugin requires a secret option.

```sh
npm install @fastify/jwt@10.2.8 fastify@5
```

**netless-io/flat-server** (683 stars)

[netless-io/flat-server](https://github.com/netless-io/flat-server) 

```javascript
async (request: FastifyRequest, reply: FastifyReply): Promise<void> => {
            try {
                await request.jwtVerify();
            } catch (err) {
                loggerServer.warn("jwt verify failed", parseError(err));
                await reply.send({
                    status: Status.Failed,
                    code: ErrorCode.JWTSignFailed,
                });

                return;
            }

            const userUUID = (request.user as { userUUID?: string } | undefined)?.userUUID;
            if (userUUID) {
                const banned = await RedisService.get(RedisKey.userBlacklist(userUUID));
                if (banned !== null) {
                    await reply.send({
                        status: Status.Failed,
                        code: ErrorCode.UserBlacklisted,
                    });
                    return;
                }
            }
        }

```

[src/plugins/fastify/authenticate.ts](https://github.com/netless-io/flat-server/blob/e6fdf472e9a91aff6302d3e2c4b8bbad19bce854/src/plugins/fastify/authenticate.ts#L25) · [More projects using Fastify JWT →](https://dashboard.exa.ai/playground/search?q=%40fastify/jwt%20GitHub%20projects)

**Quickstart**

```javascript
import Fastify from "fastify";
import jwt from "@fastify/jwt";
import { randomBytes } from "node:crypto";
const app = Fastify();
await app.register(jwt, { secret: randomBytes(32).toString("hex") });
console.log(app.jwt.sign({ sub: "user-1" }, { expiresIn: "5m" }));
await app.close();

```

From [README.md](https://raw.githubusercontent.com/fastify/fastify-jwt/main/README.md)

### express-jwt

[GitHub](https://github.com/auth0/express-jwt) · [npm](https://www.npmjs.com/package/express-jwt) · [Docs](https://raw.githubusercontent.com/auth0/express-jwt/master/README.md)

Validates JWTs in Express middleware and places the decoded payload on the request.

- Downloads / mo: 4.4M
- Stars: 4.5K
- Last release: 8.5.1
- License: MIT
- Capabilities: [From the express-jwt docs](https://raw.githubusercontent.com/auth0/express-jwt/master/README.md)

**Strengths**

- **Reads the Authorization header.** Tokens come from the Authorization header unless a custom getter is set.

**Watch out for**

- **Algorithms must be listed.** The required algorithms option guards against downgrade attacks.

```sh
npm install express-jwt@8.5.1 express
```

**Quickstart**

```javascript
const express = require("express");
const { expressjwt } = require("express-jwt");
const secret = process.env.JWT_SECRET;
if (!secret) throw new Error("Set JWT_SECRET to the issuer shared key");
const app = express();
app.get("/me", expressjwt({ secret, algorithms: ["HS256"] }), (req, res) => res.json(req.auth));
app.listen(3000);

```

From [README.md](https://raw.githubusercontent.com/auth0/express-jwt/master/README.md) · [Find projects using express-jwt →](https://dashboard.exa.ai/playground/search?q=express-jwt%20GitHub%20projects)

## FAQ

### How do I decode a JWT in JavaScript?

The decode function in [jsonwebtoken](#jsonwebtoken) returns a token's payload without checking its signature. Server code that trusts the payload calls verify instead.

### What is a JWKS?

A JWKS, or JSON Web Key Set, is a JSON document that publishes the public keys a token issuer signs with. [jose](#jose) creates a remote resolver that fetches missing or stale key sets, and [AWS JWT Verify](#aws-jwt-verify) loads the key set from its jwksUri setting.

### What is jsonwebtoken?

[jsonwebtoken](#jsonwebtoken) signs JWTs and verifies their signatures and configured claims in Node.js. It offers synchronous and callback forms of verify.

### What is JWE encryption?

JWE, or JSON Web Encryption, is the token format for encrypted payloads. [jose](#jose) provides EncryptJWT and jwtDecrypt with claims validation.

### jose vs jsonwebtoken: which should I use?

[jose](#jose) signs, verifies, and encrypts tokens across web-compatible runtimes. [jsonwebtoken](#jsonwebtoken) signs and verifies tokens in Node.js.

### Does jsonwebtoken add an expiration automatically?

A token carries an expiry only when the code sets expiresIn or an exp claim.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript JWT libraries jsonwebtoken jose fast-jwt jwt-simple code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
