Agent skill

authentication-patterns

Authentication and authorization patterns including OAuth2, JWT, RBAC, session management, and PKCE flows

Rohit Ghumare73,165★ · +3,601/wk · 3 repos on radarProfile →
claude-codeApache-2.0
Install
npx skills add rohitg00/awesome-claude-code-toolkit --skill authentication-patterns --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 5 KB
Bundled scripts: none
Path: skills/authentication-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 2,438
Language: JavaScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Authentication Patterns ## JWT Access and Refresh Tokens ```typescript import jwt from "jsonwebtoken"; interface TokenPayload { sub: string; email: string; roles: string[]; } function generateTokens(user: User) { const accessToken = jwt.sign( { sub: user.id, email: user.email, roles: user.roles }, process.env.JWT_SECRET!, { expiresIn: "15m", issuer: "auth-service" } ); const refreshToken = jwt.sign( { sub: user.id, tokenVersion: user.tokenVersion }, process.env.REFRESH_SECRET!, { expiresIn: "7d", issuer: "auth-service" } ); return { accessToken, refreshToken }; } function verifyAccessToken(token: string): TokenPayload { return jwt.verify(token, process.env.JWT_SECRET!, { issuer: "auth-service", }) as TokenPayload; } ``` Short-lived access tokens (15 minutes) with longer-lived refresh tokens (7 days). Store refresh tokens in HTTP-only cookies. ## Auth Middleware ```typescript function authenticate(req: Request, res: Response, next: NextFunction) { const header = req.headers.authorization; if (!header?.startsWith("Bearer ")) { return res.status(401).json({ error: "Missing authorization header" }); } try { const payload = verifyAccessToken(header.slice(7)); req.user = payload; next(

What's inside
Steps it walks through
  1. JWT Access and Refresh Tokens
  2. Auth Middleware
  3. OAuth2 Authorization Code Flow with PKCE
  4. RBAC Model
  5. Anti-Patterns
  6. Checklist
More from awesome-claude-code-toolkit
All skills →
About this skill
What does the authentication-patterns skill do?

Authentication and authorization patterns including OAuth2, JWT, RBAC, session management, and PKCE flows

How do I install it?

Run `npx skills add rohitg00/awesome-claude-code-toolkit --skill authentication-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From rohitg00/awesome-claude-code-toolkit, a repository with 2,438 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going