A JSON Web Token (JWT) library that extends jsonwebtoken by adding Redis-backed token revocation. v7.0.3 wraps the full jsonwebtoken API with methods sign, verify, decode, and destroy; the destroy method removes a token's jti from Redis, making it immediately invalid. It requires Redis client (node-redis v4+). Uses ESM by default; ships TypeScript definitions. Key differentiator: ability to revoke tokens before expiry, unlike jsonwebtoken itself.
npm install jwt-redisNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows sign, verify, and destroy operations with ESM imports and async/await.
Use new JWTR(redisClient) with a connected Redis client; do not pass legacy client types.
Migrate from ioredis to the redis package (v4+).
When using require, always add .default.
Either let the library generate jti or provide your own unique value in payload.
Handle the 'jwt revoked' error in your application logic.
Pass a connected Redis client instance: const jwtr = new JWTR(redisClient);
Use import JWTR from 'jwt-redis'; then const jwtr = new JWTR(redis); jwtr.sign(...);
Ensure the token has not been destroyed, or verify that the Redis prefix matches (default 'jwt_label:').