auth0/express-jwt

connect/express middleware that validates a JsonWebToken (JWT) and set the req.user with the attributes

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 54 minutes ago
Added to GitGenius on September 15th, 2026
Created on October 22nd, 2013
Open Issues & Pull Requests: 65 (+0)
GitHub issues: Enabled
Number of forks: 444
Total Stargazers: 4,508 (+0)
Total Subscribers: 148 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 2.8 days
Mean response time: 273.8 days
90th percentile: 921.9 days
Tracked items: 7

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 6
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 961 days
Stale 30+ days: 6
Stale 90+ days: 6

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

express-jwt is middleware for Express that validates JSON Web Tokens and makes the decoded payload available on the request object.

The module solves the problem of authenticating requests in Express applications by validating JWTs before they reach route handlers. It wraps the jsonwebtoken library and integrates it as Express middleware. The decoded JWT payload is attached to the request object, defaulting to the `req.auth` property. By default, the middleware extracts tokens from the Authorization header as OAuth2 Bearer tokens, though this behavior can be customized through a `getToken` function. The middleware supports symmetric secrets, asymmetric public/private key pairs, and dynamic key retrieval through a callback function. Additional security features include token revocation checking via an `isRevoked` callback, custom expiration handling, and support for validating audience and issuer claims.

Developers should adopt this tool if they need straightforward JWT validation in Express applications. It suits projects that use Bearer token authentication and want to avoid writing custom validation logic. The middleware can be applied selectively to specific routes using Express router patterns or the `unless` method to exclude certain paths from protection. The `credentialsRequired` option allows requests without tokens to pass through to the next middleware, useful for endpoints that should work both with and without authentication. The module emphasizes security by requiring explicit specification of the `algorithms` parameter to prevent downgrade attacks and warns against mixing symmetric and asymmetric algorithms without additional validation.

The project maintains active engagement with security considerations, as evidenced by detailed warnings in the documentation about algorithm mixing and downgrade vulnerabilities. Development activity shows consistent attention to the middleware's integration with Express patterns and the underlying jsonwebtoken library. The codebase is written in TypeScript, providing type safety for developers using the module.