Skip to content

Node.js JWT authentication with access and refresh tokens, plus role-based access control middleware.

CCM score
37 of 100
skills.sh installs
227
GitHub stars
2
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers registration, login, protected routes, token refresh, and password reset flows for Express apps
  • Includes code for generateToken, register, login, authenticate, authorize, and refreshAccessToken using jsonwebtoken and bcryptjs
  • Enforces short-lived access tokens (15 minutes to 1 hour), longer refresh tokens stored in the database, and bcrypt password hashing
  • Suited to stateless REST APIs, mobile backends, and microservices that need authentication without server-side sessions

Install

$ npx -y skills add pluginagentmarketplace/custom-plugin-nodejs --skill jwt-authentication -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

JWT Authentication Skill

Implement secure, scalable authentication in Node.js applications using JSON Web Tokens.

Quick Start

JWT authentication in 4 steps:

  1. Install - npm install jsonwebtoken bcryptjs
  2. Register - Hash password, create user, generate token
  3. Login - Verify password, generate token
  4. Protect - Verify token in middleware

Core Concepts

Generate JWT

const jwt = require('jsonwebtoken');

function generateToken(userId) {
  return jwt.sign(
    { id: userId },
    process.env.JWT_SECRET,
    { expiresIn: '1h' }
  );
}

function generateRefreshToken(userId) {
  return jwt.sign(
    { id: userId },
    process.env.JWT_REFRESH_SECRET,
    { expiresIn: '7d' }
  );
}

User Registration

const bcrypt = require('bcryptjs');

async function register(req, res) {
  const { email, password, name } = req.body;

  // Check if user exists
  const existingUser = await User.findOne({ email });
  if (existingUser) {
    return res.status(409).json({ error: 'User already exists' });
  }

  // Hash password
  const hashedPassword = await bcrypt.hash(password, 10);

Details

Repository
github.com/pluginagentmarketplace/custom-plugin-nodejs
Categories
Backend & APIs, Security
First seen
Jun 3, 2026

Questions

What does the jwt-authentication skill help me build in Node.js?

The jwt-authentication skill implements secure JWT authentication in Node.js applications with access and refresh tokens. It also covers role-based access control, so routes can be limited to users with specific roles.

How do I install the jwt-authentication skill?

Run npx -y skills add pluginagentmarketplace/custom-plugin-nodejs --skill jwt-authentication -y in your project. After that, the agent can use the skill to write JWT login, registration and middleware code.

Who is the jwt-authentication skill for?

It suits developers building stateless REST APIs, mobile app backends or microservices that need token-based login. The skill walks through registration, login, token refresh and password reset flows in Node.js.

Where does jwt-authentication sit in the Backend and APIs category?

This skill is listed in the Backend and APIs category on Claude Marketplaces, alongside entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. It focuses on JWT token handling, access and refresh tokens, and role checks for Node.js servers.

More from pluginagentmarketplace/custom-plugin-nodejs

All 4

Similar to Jwt Authentication

More Backend & APIs