jwt-authentication

Generate and verify JWT access and refresh tokens with role-based access control in Node.js.

2|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-nodejs --skill jwt-authentication-pluginagentmarketplace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jwt-authentication
Source: https://github.com/pluginagentmarketplace/custom-plugin-nodejs/tree/main/skills/jwt-authentication
Command: npx skills add https://github.com/pluginagentmarketplace/custom-plugin-nodejs --skill jwt-authentication-pluginagentmarketplace

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Secure, scalable authentication in Node.js applications using JSON Web Tokens (JWT) with access and refresh tokens and role-based access control.

Core Features & Use Cases

  • Generate and verify access and refresh tokens for user sessions.
  • Enforce role-based access control via middleware on protected routes.
  • Hash passwords and manage user registration/login flows, including token refresh and revocation.

Quick Start

Install the necessary packages and wire up the authentication middleware to protect routes.

Frequently Asked Questions about jwt-authentication

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement JWT authentication with access and refresh tokens in Node.js?

JWT authentication in Node.js uses JSON Web Tokens for secure user sessions by generating access tokens for protected routes and refresh tokens to maintain login state without re-entering credentials. This process includes password hashing and token verification middleware.

What is the best way to add role-based access control to protected routes in a Node.js app?

Role-based access control (RBAC) in a Node.js app restricts route access by verifying user permissions through middleware. It checks JWT claims against required roles before allowing entry to protected endpoints, ensuring only authorized users can execute specific operations.

How does token refresh and revocation work for user sessions?

Token refresh and revocation maintain secure user sessions by issuing new access tokens using valid refresh tokens. Revocation invalidates existing tokens to immediately block access when users log out or when session security is compromised.

Does this JWT authentication approach handle user signup and login flows?

Yes, JWT authentication handles user signup and login flows by hashing passwords during registration and verifying credentials during login. It then generates access and refresh tokens to authenticate subsequent requests to protected routes.

Why do I need password hashing for JWT authentication in Node.js?

Password hashing is required for JWT authentication in Node.js to protect user credentials by converting plain-text passwords into irreversible hashes. This ensures that even if the database is compromised, the actual login secrets remain secure.

Can I use JWT middleware to protect specific routes instead of the entire application?

Yes, JWT middleware can be selectively applied to protect specific routes in Node.js applications. You wire up the token verification middleware on individual endpoints to enforce authentication and role-based access control only where needed.