{"id":18751,"library":"restify-jwt-community","title":"restify-jwt-community","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/frbuceta/restify-jwt-community","tags":["javascript","auth","authentication","authorization","http","jwt","token","oauth","restify"],"install":[{"cmd":"npm install restify-jwt-community","lang":"bash","label":"npm"},{"cmd":"yarn add restify-jwt-community","lang":"bash","label":"yarn"},{"cmd":"pnpm add restify-jwt-community","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for verifying and decoding JWT tokens","package":"jsonwebtoken","optional":false},{"reason":"Peer dependency; the middleware is designed to work with Restify","package":"restify","optional":false}],"imports":[{"note":"Default import; common mistake is to use .default when importing in CommonJS.","wrong":"const jwt = require('restify-jwt-community').default","symbol":"jwt","correct":"import jwt from 'restify-jwt-community'"},{"note":"CommonJS require returns the default export directly, no .default needed.","wrong":"","symbol":"jwt","correct":"const jwt = require('restify-jwt-community')"},{"note":"Named export; ensure correct casing (UnauthorizedError, not unauthorizedError).","wrong":"const UnauthorizedError = require('restify-jwt-community').UnauthorizedError","symbol":"UnauthorizedError","correct":"import { UnauthorizedError } from 'restify-jwt-community'"}],"quickstart":{"code":"import restify from 'restify';\nimport jwt from 'restify-jwt-community';\n\nconst server = restify.createServer();\n\nserver.use(restify.plugins.bodyParser());\nserver.use(jwt({ secret: process.env.JWT_SECRET || 'your-secret-key' }));\n\nserver.get('/protected', (req, res, next) => {\n  res.send(200, { user: req.user });\n  return next();\n});\n\nserver.listen(3000, () => {\n  console.log('Server listening on port 3000');\n});","lang":"typescript","description":"Basic setup of Restify server with JWT middleware for a protected route."},"warnings":[{"fix":"Ensure you call return next() after res.send() in route handlers.","message":"Failing to call next() after res.send may cause hanging requests","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check that you are using restify, not express. This package is incompatible with Express.","message":"The middleware requires a restify server; do not use with Express or other frameworks","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always provide a secret or a function that returns a secret to jwt().","message":"The middleware will throw if no secret is provided","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Pass a secret or a function returning a secret: jwt({ secret: 'my-secret' })","cause":"No secret was passed to the jwt middleware.","error":"Error: secret must be provided"},{"fix":"Use correct import: import jwt from 'restify-jwt-community' or const jwt = require('restify-jwt-community')","cause":"Using ES6 import syntax with CommonJS require incorrectly.","error":"TypeError: restify_jwt_community_1.default is not a function"},{"fix":"Include an Authorization header with value 'Bearer <token>' in the request.","cause":"Request did not include an Authorization header with a Bearer token.","error":"UnauthorizedError: No authorization token was found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}