Oauth oidc implementer

From curiositech/windags-skills · View interactive version

Oauth oidc implementer is an AI agent skill from the GitHub repository curiositech/windags-skills. Expert in implementing OAuth 2.0 and OpenID Connect (OIDC) authentication flows. Specializes in secure token handling, social login integration, API authorization, and identity provider configuration. Use when the user explicitly needs oauth oidc implementer help. NOT for unrelated tasks.

How to use this skill

Skill file

OAuth/OIDC Implementer

Expert in implementing OAuth 2.0 and OpenID Connect (OIDC) authentication flows. Specializes in secure token handling, social login integration, API authorization, and identity provider configuration.

Decision Points

Flow Selection Matrix

For Web Applications (with backend):

For API Access:

For Enterprise SSO:

Token Storage Decision Tree

Access Tokens:

Refresh Tokens:

Failure Modes

Invalid Grant Error

Detection: Error response contains "error": "invalid_grant"

Root Cause: Authorization code expired (>10min) or PKCE verifier mismatch

Fix: Implement proper code exchange timing and verify PKCE generation/storage

Token Expired Syndrome

Detection: API returns 401 with expired token, no automatic retry

Root Cause: Missing token refresh logic or refresh token rotation failure

Fix: Implement automatic refresh with race condition handling and fallback to login

State Mismatch Vulnerability

Detection: OAuth callback validation fails with state parameter errors

Root Cause: State not properly stored/validated or CSRF attack in progress

Fix: Verify state generation uses cryptographically secure randomness and server-side validation

Scope Creep Anti-pattern

Detection: Requesting excessive scopes (scope=* or kitchen-sink permissions)

Root Cause: Over-requesting permissions instead of minimal viable scopes

Fix: Request only needed scopes initially, use incremental authorization for additional permissions

Silent Login Loop

Detection: Infinite redirects between app and identity provider

Root Cause: Session state mismatch or malformed logout implementation

Fix: Implement proper session cleanup and logout flow with back-channel notification

Worked Example: SPA Social Login Implementation

Scenario: React app implementing "Login with Google" using Authorization Code + PKCE

Step 1: Initialize Flow

// Expert catches: PKCE generation must be cryptographically secure
const codeVerifier = base64URLEncode(crypto.getRandomValues(new Uint8Array(32)));
const codeChallenge = base64URLEncode(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier)));

// Novice misses: State must be stored server-side to prevent tampering
const state = crypto.randomUUID();
sessionStorage.setItem('oauth_state', state);
sessionStorage.setItem('pkce_verifier', codeVerifier);

Step 2: Decision Point Navigation

Step 3: Handle Callback

// Expert validates: State MUST match exactly
if (urlState !== sessionStorage.getItem('oauth_state')) {
  throw new Error('CSRF protection failed');
}

// Novice misses: Code verifier must be included in token exchange
const tokenRequest = {
  grant_type: 'authorization_code',
  code: authCode,
  code_verifier: sessionStorage.getItem('pkce_verifier'),
  client_id: CLIENT_ID,
  redirect_uri: REDIRECT_URI
};

Step 4: Token Handling

Quality Gates

Implementation checklist for production readiness:

NOT-FOR Boundaries

Do NOT use this skill for:

Delegate to other skills:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.