Skip to content
Back to skills

Auth

ASecurity

Authentication routes: GitHub OAuth login/callback, JWT validate, logout. Trigger: when initializing auth layer in FastAPI application.

  • 5 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 26, 2026
ai-agentspythongobashfastapidockergitapidatabase

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 4, 2026

npx -y skills add JNZader/repoforge --skill auth --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Auth?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Auth
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jnzader-auth/badge)](https://www.skillsdirectory.com/skills/jnzader-auth)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: add-auth-routes
description: >
  Authentication routes: GitHub OAuth login/callback, JWT validate, logout.
  Trigger: when initializing auth layer in FastAPI application.
license: Apache-2.0
metadata:
  author: repoforge
  version: "1.0"
  complexity: medium
  token_estimate: 450
  dependencies: []
  related_skills: []
  load_priority: high
---

<!-- L1:START -->
# add-a-t, 1-11.1111.11.1.1.1ant 1111.111.111.111.111.">Return to home</a>.
<!-- L1:END -->

<!-- L2:START -->
## Quick Reference

| Task | Pattern |
|------|---------|
| login | `login(request)` |
| validate_token | `validate_token(request, current_user)` |
| logout | `logout(request, current_user)` |

## Critical Patterns (Summary)
- **login**: Handles GitHub OAuth initiation with OAuth2 flow
- **validate_token**: Validates JWT and retrieves current user
<!-- L2:END -->

<!-- L3:START -->
## Critical Patterns (Detailed)

### login

Handles GitHub OAuth initiation. Redirects to GitHub's OAuth authorization page with required scopes.

```python
// Real code using actual exported names from this module
from fastapi import Request
from fastapi.responses import RedirectResponse

async def login(request: Request) -> RedirectResponse:
    return RedirectResponse(url="/auth/github")
```

### validate_token

Validates JWT token and retrieves the current authenticated user from the session.

```python
// Real code using actual exported names from this module
from fastapi import Request
from typing import CurrentUser

async def validate_token(request: Request, current_user: CurrentUser) -> AuthValidateResponse:
    if not current_user:
        return {"valid": False, "detail": "Not authenticated"}
    return {"valid": True, "user": current_user}
```

## When to Use

- GitHub OAuth login flow initiation
- JWT token validation for protected endpoints
- User logout cleanup

## Commands

```bash
# Start the server with auth routes
docker compose up -d
# Apply database migrations for auth tables
python -m alembic upgrade head
```

## Anti-Patterns

### Don't: reuse JWT across requests without validation

<Why it the anti-pattern is wrong — one sentence.>
Storing raw JWT tokens in client-side storage without server-side validation allows token tampering and replay attacks.

```python
// BAD
// Storing raw token without validation
token = request.cookies.get("jwt")
#on The1s on on, we., on, on, and test, on, 1,o, 
 
1. 1., 
t, ,u, 
n,,u,,u,,u,,u,,u, ,  (This,u,,u,,u, ,,n, ,,u,  (nil, ,u,,u, ,,u, ,,u,,u,  ,,n,,,u,,u, ,,,u, ,, ,,u,,,u,,u, ,,,u, ,,,u,,,u, ,,,,,,u,,,u, ,, , , ( (1,,u, , ,,u,  (,,u,,u,  (,,u, ,,u,,u,, 1, ,,,,u, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, (,  , 1,  ,, 
-, 
,  , ,,  ,  1, ,,  ,  1,,  1, ,  1,,  1,  1, 
 ,  ,,  1,,  
 , 
 , 
, 
, 
 , 
 , 
b. , ,, 
, 
b. ,, 
b. 
, 
, , 
 ,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
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 
 
n. 

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.