JWT authentication middleware for Restify, current stable version 2.0.0 (released 2023-03-27). This community-maintained fork validates JSON Web Tokens and sets req.user on incoming requests. It builds on auth0/express-jwt and the original restify-jwt, but uses restify's built-in error objects. Maintenance cadence is low (last release v2.0.0, prior updates were mostly lockfile maintenance). Compared to express-jwt, this is tailored specifically for Restify and uses restify errors.
npm install restify-jwt-communityVerified import paths — ran on the pinned version, not inferred.
Basic setup of Restify server with JWT middleware for a protected route.
Ensure you call return next() after res.send() in route handlers.
Check that you are using restify, not express. This package is incompatible with Express.
Always provide a secret or a function that returns a secret to jwt().
Pass a secret or a function returning a secret: jwt({ secret: 'my-secret' })Use correct import: import jwt from 'restify-jwt-community' or const jwt = require('restify-jwt-community')Include an Authorization header with value 'Bearer <token>' in the request.