authentication-authorization
Use when implementing auth — login, registration, session management, JWT, OAuth, password hashing, RBAC, API keys, MFA, and security headers.
Skill by UgochukwuChidera
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/ugochukwuchidera-authentication-authorization
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, testing, security
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/authentication-authorization
What's inside
- Skill name
authentication-authorization- Description
- Use when implementing auth — login, registration, session management, JWT, OAuth, password hashing, RBAC, API keys, MFA, and security headers. Covers both stateless (JWT) and stateful (session) patterns, social login, permission models, and auth testing.
- License
- GPL-3.0
- Instructions
- 244 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Authentication & Authorization
## First Decision: Stateless vs Stateful
| | JWT (Stateless) | Sessions (Stateful) |
|---|---|---|
| **Storage** | Client (token) | Server (DB/Redis) |
| **Scale** | No server state — easy horizontal scale | Need shared session store (Redis) |
| **Revoke** | Hard — wait for expiry or maintain blocklist | Instant — delete session |
| **Payload** | Visible to client (don't put secrets) | Opaque to client |
| **Best for** | APIs, mobile, SPAs, microservices | Server-rendered apps, high-security |
| **Library** | `jsonwebtoken`, `jose` | `express-session`, `iron-session` |
**Default for Meta-Architect projects:** JWT with refresh tokens (stateless API + stateful refresh).
## JWT Pattern (Default)
### Token Structure
```typescript
interface JwtPayload {
sub: string; // user id — never email (emails change)
role: string; // for quick authz checks
iat: number; // issued at
exp: number; // expiry
jti?: string; // token id (for revocation)
}
```
### Implementation
```typescript
// auth.service.ts
import jwt from 'jsonwebtoken';
const ACCESS_SECRET = process.env.JWT_ACCESS_SECRET!;
const REFRESH_SECRET = process.env.JWT_REFRESH_SECRET!;
const ACCESS_EXPIRY = '15m';
const REFRESH_EXPIRY = '7d';
export function generateTokens(user: { id: string; role: string }) {
const accessToken = jwt.sign(
{ sub: user.id, role: user.role },
ACCESS_SECRET,
{ expiresIn: ACCESS_EXPIRY }
);
const refreshToken = jwt.sign(
{ sub: user.id, jti: crypto.randomUUID() },
REFRESH_SECRET,
{ expiresIn: REFRESH_EXPIRY }
);
return { accessToken, refreshToken, expiresIn: 900 };
}
export function verifyAccessToken(token: string): JwtPayload {
return jwt.verify(token, ACCESS_SECRET) as JwtPayload;
}
export function verifyRefreshToken(token: string): { sub: string; jti: string } {
return jwt.verify(token, REFRESH_SECRET) as { sub: string; jti: string };
}
```
### Refresh Token Rotation
```typescript
// On every refresh: issue new pair, invalidate old refresh token
export async function refreshTokens(oldRefreshToken: string, prisma: PrismaClient) {
const payload = verifyRefreshToken(oldRefreshToken);
// Check if token was already used (rotation prevents replay)
const stored = await prisma.refreshToken.findUnique({ where: { jti: payload.jti } });
if (!stored) throw new Error('Token revoked — possible theft');
// Delete old token, issue new pair
await prisma.refreshToken.delete({ where: { jti: payload.jti } });
const user = await prisma.user.findUniqueOrThrow({ where: { id: payload.sub } });
const tokens = generateTokens(user);
await prisma.refreshToken.create({
data: { jti: jwt.decode(tokens.refreshToken)!.jti, userId: user.id, expiresAt: new Date(Date.now() + 7 * 86400000) },
});
return tokens;
}
```
### Auth Middleware
```typescript
// auth.middleware.ts
export function authenticate(req: Request, res: Response, next: NextFunction) {
const header = req.headers.authorization;
if (!header?.startsWith('Bearer ')) return res.status(401).json({ error: 'unauthorized' });
try {
const payload = verifyAccessToken(header.split(' ')[1]);
req.user = { id: payload.sub, role: payload.role };
next();
} catch {
return res.status(401).json({ error: 'token_expired' });
}
}
```
## Password Hashing
```typescript
import bcrypt from 'bcryptjs';
const SALT_ROUNDS = 12; // ~250ms — balance security vs speed
export async function hashPassword(password: string): Promise<string> {
return bcrypt.hash(password, SALT_ROUNDS);
}
export async function verifyPassword(password: string, hash: string): Promise<boolean> {
return bcrypt.compare(password, hash);From UgochukwuChidera/Opencode-Agents, GPL-3.0.
More from UgochukwuChidera/Opencode-Agents
- 0.474score
tool-preference
UgochukwuChidera
Use when deciding whether to use a plugin tool or bash.
SkillCFreshness: CClaude Code +9 - 0.474score
grill-with-docs
UgochukwuChidera
Use when you need to conduct a structured design interview AND persist the results as documentation.
SkillCFreshness: CClaude Code +9 - 0.474score
segmented-prompt-execution
UgochukwuChidera
Use when executing prompts sequentially from a build plan.
SkillCFreshness: CClaude Code +9 - 0.474score
grill-me
UgochukwuChidera
Use when conducting structured design interviews to discover shared language, uncover implicit assumptions, and refine project terminology before planning or…
SkillCFreshness: CClaude Code +9 - 0.474score
api-design
UgochukwuChidera
Use when designing REST or GraphQL APIs, defining endpoints, request/response shapes, error responses, pagination, versioning, authentication, or OpenAPI specs.
SkillCFreshness: CClaude Code +9 - 0.474score
database-data-layer
UgochukwuChidera
Use when designing or implementing database schemas, data models, migrations, seeding, and query layers.
SkillCFreshness: CClaude Code +9 - 0.474score
deployment-devops
UgochukwuChidera
Use when setting up deployment, Docker, CI/CD, environment configuration, hosting, and infrastructure.
SkillCFreshness: CClaude Code +9 - 0.474score
design-system-implementation
UgochukwuChidera
Use when implementing UI components from design token specifications.
SkillCFreshness: CClaude Code +9 - 0.474score
error-handling
UgochukwuChidera
Use when handling errors, building error boundaries, designing error responses, or adding logging/observability.
SkillCFreshness: CClaude Code +9 - 0.474score
meta-architect-patterns
UgochukwuChidera
Use when executing a Meta-Architect build plan from plan.json.
SkillCFreshness: CClaude Code +9 - 0.474score
react-patterns
UgochukwuChidera
Use when discussing React component design, hooks, state management, or rendering patterns.
SkillCFreshness: CClaude Code +9 - 0.474score
security-review
UgochukwuChidera
Use when reviewing code for security vulnerabilities, auditing authentication/authorization, handling secrets, or assessing OWASP Top 10 risks.
SkillCFreshness: CClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jun 22, 2026 (4 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- GPL-3.0
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from UgochukwuChidera
- 0.474score
grill-me
UgochukwuChidera
Use when conducting structured design interviews to discover shared language, uncover implicit assumptions, and refine project terminology before planning or…
SkillCFreshness: CClaude Code +9 - 0.474score
grill-with-docs
UgochukwuChidera
Use when you need to conduct a structured design interview AND persist the results as documentation.
SkillCFreshness: CClaude Code +9 - 0.474score
api-design
UgochukwuChidera
Use when designing REST or GraphQL APIs, defining endpoints, request/response shapes, error responses, pagination, versioning, authentication, or OpenAPI specs.
SkillCFreshness: CClaude Code +9 - 0.474score
database-data-layer
UgochukwuChidera
Use when designing or implementing database schemas, data models, migrations, seeding, and query layers.
SkillCFreshness: CClaude Code +9 - 0.474score
deployment-devops
UgochukwuChidera
Use when setting up deployment, Docker, CI/CD, environment configuration, hosting, and infrastructure.
SkillCFreshness: CClaude Code +9 - 0.474score
design-system-implementation
UgochukwuChidera
Use when implementing UI components from design token specifications.
SkillCFreshness: CClaude Code +9
Cite this page
authentication-authorization skill. Agent Mart. https://agentmart.dev/skills/ugochukwuchidera-authentication-authorization (last updated 2026-10-24)