← ClaudeAtlas

oauth2listed

OAuth 2.0 authorization framework. Covers flows, tokens, and provider integration. Use for third-party authentication. USE WHEN: user mentions "OAuth", "Google login", "GitHub auth", "social login", "authorization code flow", "PKCE", asks about "third-party auth", "provider integration" DO NOT USE FOR: JWT tokens (use jwt skill), NextAuth.js (use nextauth skill), API keys, simple password auth
claude-dev-suite/claude-dev-suite · ★ 33 · AI & Automation · score 80
Install: claude install-skill claude-dev-suite/claude-dev-suite
# OAuth 2.0 Core Knowledge > **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `oauth2` for comprehensive documentation. ## Authorization Code Flow (Recommended) ``` 1. User clicks "Login with Google" 2. Redirect to provider: GET https://accounts.google.com/oauth/authorize ?client_id=xxx &redirect_uri=https://app.com/callback &response_type=code &scope=openid email profile &state=random_state 3. User authorizes, provider redirects: GET https://app.com/callback?code=xxx&state=random_state 4. Backend exchanges code for tokens: POST https://oauth2.googleapis.com/token client_id=xxx client_secret=xxx code=xxx grant_type=authorization_code redirect_uri=https://app.com/callback 5. Receive tokens: { "access_token": "...", "refresh_token": "...", "id_token": "..." } ``` ## Implementation ```typescript // Step 1: Generate auth URL function getAuthUrl(): string { const params = new URLSearchParams({ client_id: process.env.GOOGLE_CLIENT_ID, redirect_uri: `${process.env.APP_URL}/callback`, response_type: 'code', scope: 'openid email profile', state: generateRandomState(), }); return `https://accounts.google.com/oauth/authorize?${params}`; } // Step 2: Handle callback async function handleCallback(code: string) { const tokens = await exchangeCodeForTokens(code); const userInfo = await getUserInfo(tokens.access_token); const user = await findOrCreateUser(userInfo);