Skip to content
Agentmart
Submit a tool

authentication-skill

Implements authentication and authorisation systems including JWT, OAuth2, sessions, MFA, social login, RBAC, and refresh token rotation.

Skill by The13thNode

IndexedMIT★ 3
Write a review

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/the13thnode-authentication-skill

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.

We use your email only for this newsletter. Privacy

About

Implements authentication and authorisation systems including JWT, OAuth2, sessions, MFA, social login, RBAC, and refresh token rotation. Use when building any login/signup system, adding social auth, implementing role-based access, or designing permission systems. Trigger for "authentication", "login system", "JWT", "OAuth", "social login", "Google login", "RBAC", "permissions", "MFA", or "session management". Part of the Founder OS engineering suite.

Use cases: security

No 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-skill

What's inside

Skill name
authentication-skill
Description
Implements authentication and authorisation systems including JWT, OAuth2, sessions, MFA, social login, RBAC, and refresh token rotation. Use when building any login/signup system, adding social auth, implementing role-based access, or designing permission systems. Trigger for "authentication", "login system", "JWT", "OAuth", "social login", "Google login", "RBAC", "permissions", "MFA", or "session management". Part of the Founder OS engineering suite.
License
MIT
Instructions
212 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Authentication — Founder OS

## Framework 1: Auth Strategy Selection

| Method | Best For | Complexity | Use When |
|--------|---------|-----------|---------|
| JWT (stateless) | APIs, SPAs, mobile | Medium | Microservices, need to verify without DB lookup |
| Session (stateful) | Traditional web apps | Low | Simpler to revoke, server-side rendering |
| OAuth2 (social) | User acquisition | Medium | Want Google/GitHub login, reduce friction |
| Magic link | Low-friction onboarding | Low | No password friction, B2C products |
| Passkeys (WebAuthn) | Modern, passwordless | High | Future-proofing, security-focused products |

**Recommendation for most SaaS founders:** Start with a managed auth provider (Clerk, Auth0, Supabase Auth, NextAuth). Don't build auth from scratch — it's a security liability.

---

## Framework 2: JWT Implementation

### JWT Structure
```
Header.Payload.Signature

Header: { "alg": "HS256", "typ": "JWT" }
Payload: {
  "sub": "user_123",          // Subject (user ID)
  "iat": 1704067200,          // Issued at (Unix timestamp)
  "exp": 1704153600,          // Expiry (Unix timestamp)
  "jti": "unique_token_id",   // JWT ID (for revocation)
  "role": "admin",            // Custom claims
  "orgId": "org_456"          // Custom claims
}
```

### Token Rotation Pattern
```typescript
// Access token: short-lived (15 minutes)
// Refresh token: long-lived (7-30 days), stored in httpOnly cookie

// On login
const accessToken = jwt.sign(
  { sub: user.id, role: user.role, orgId: user.orgId },
  process.env.JWT_SECRET,
  { expiresIn: '15m' }
);

const refreshToken = crypto.randomBytes(32).toString('hex');
await db.refreshToken.create({
  data: {
    token: hashToken(refreshToken),  // Hash before storing
    userId: user.id,
    expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000)
  }
});

// Set refresh token as httpOnly cookie (not accessible to JS)
res.cookie('refresh_token', refreshToken, {
  httpOnly: true,
  secure: true,       // HTTPS only
  sameSite: 'strict',
  maxAge: 30 * 24 * 60 * 60 * 1000
});

// On refresh
// 1. Validate refresh token from cookie
// 2. Delete old refresh token (rotation)
// 3. Issue new access token + new refresh token
// 4. Set new refresh token cookie
```

### Auth Middleware
```typescript
export async function requireAuth(req: Request, res: Response, next: NextFunction) {
  const token = req.headers.authorization?.replace('Bearer ', '');

  if (!token) {
    return res.status(401).json({
      success: false,
      error: { code: 'UNAUTHORIZED', message: 'Authentication required' }
    });
  }

  try {
    const payload = jwt.verify(token, process.env.JWT_SECRET!) as JWTPayload;
    req.user = { id: payload.sub, role: payload.role, orgId: payload.orgId };
    next();
  } catch {
    return res.status(401).json({
      success: false,
      error: { code: 'TOKEN_INVALID', message: 'Token is invalid or expired' }
    });
  }
}
```

---

## Framework 3: OAuth2 / Social Login

### OAuth2 Flow (Google example)
```
1. User clicks "Sign in with Google"
2. Redirect to Google: GET /oauth2/auth?client_id=...&redirect_uri=...&scope=email+profile
3. User authenticates with Google
4. Google redirects back: GET /auth/callback?code=xyz123
5. Exchange code for tokens: POST /oauth2/token
6. Get user info: GET /userinfo (with access_token)
7. Create/find user in your DB, issue your own session/JWT
```

### State Parameter (CSRF protection — required)
```typescript
// Before redirecting to OAuth provider
const state = crypto.randomBytes(16).toString('hex');
req.session.oauthState = state;

const authUrl = new URL('https://accounts.google.com/o/oauth2/v2/auth');
authUrl.searchParams.set('state', state);  // Include state

// On callback

From The13thNode/VibeCorp_PromptCEO, MIT.

More from The13thNode/VibeCorp_PromptCEO

Signals

Stars
3
Forks
0
Open issues
0
Last commit (this folder)
Mar 26, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from The13thNode

Cite this page

authentication-skill. Agent Mart. https://agentmart.dev/skills/the13thnode-authentication-skill (last updated 2026-10-24)