authentication-patterns
Authentication and authorization patterns including OAuth2, JWT, RBAC, session management, and PKCE flows
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.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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(
- JWT Access and Refresh Tokens
- Auth Middleware
- OAuth2 Authorization Code Flow with PKCE
- RBAC Model
- Anti-Patterns
- Checklist
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.