oauth-flow-architect

Implements OAuth 2.0 and OpenID Connect authentication flows with PKCE and token management.

Updated May 16, 2026
One-click install
npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill oauth-flow-architect-organvm-i-theoria
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: oauth-flow-architect
Source: https://github.com/organvm-i-theoria/_agent-ontology/tree/main/.agents/skills/oauth-flow-architect
Command: npx skills add https://github.com/organvm-i-theoria/_agent-ontology --skill oauth-flow-architect-organvm-i-theoria

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyjwt, cryptography, flask, and includes references (resource) components.

What problem does it solve? Implementing OAuth 2.0 and OpenID Connect correctly is error-prone: misconfigured redirect URIs, missing PKCE, weak state parameters, and insecure token storage lead to real security vulnerabilities. This Skill provides complete, security-hardened implementation guidance for authentication flows. ## Core Features & Use Cases - Flow Implementation: Authorization Code with PKCE, Client Credentials, and Refresh Token flows with working Python code for authorization URLs, callbacks, and token exchange. - OIDC Support: ID token validation with JWKS, nonce checking, and provider discovery via .well-known/openid-configuration. - Security Hardening: CSRF protection via state parameters, strict redirect URI validation, encrypted token storage, and refresh token rotation with reuse detection. - Use Case: You are adding "Sign in with Google" to a Flask app. Use this Skill to generate the PKCE authorization URL, handle the callback, validate the ID token, and store encrypted refresh tokens. ## Quick Start Implement an OAuth 2.0 Authorization Code flow with PKCE for Google sign-in, including the callback handler and secure token storage.

Frequently Asked Questions about oauth-flow-architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement OAuth 2.0 Authorization Code flow with PKCE in Python?▼

Generate a code_verifier with secrets.token_urlsafe(32), derive the code_challenge via SHA256, and include it in the authorization URL. On callback, exchange the code plus the original verifier at the token endpoint to receive access and ID tokens.

How to validate an OpenID Connect ID token?▼

Fetch the provider's signing key from its JWKS URI using PyJWKClient, then decode the JWT verifying the RS256 signature, audience, and issuer. Also check the nonce claim when one was sent in the authorization request to prevent replay attacks.

Does GitHub OAuth support OpenID Connect?▼

No, GitHub implements OAuth 2.0 only, not OIDC, so there is no ID token. You must call the api.github.com/user endpoint with the access token, and include an Accept: application/json header on the token exchange request.

Why does my OAuth callback fail with an invalid state error?▼

The state parameter returned by the provider does not match the value stored in the user's session before redirect. This indicates a CSRF attempt, a lost session cookie, or a mismatched session store across servers.

When should I use Client Credentials instead of Authorization Code flow?▼

Use Client Credentials for machine-to-machine authentication where no user is involved, such as backend services calling an API. It exchanges client_id and client_secret directly for an access token without any redirect or user consent.

How should refresh tokens be stored and rotated securely?▼

Encrypt refresh tokens at rest using a symmetric cipher like Fernet and never log them. Rotate on each use, mark old tokens as consumed, and revoke the entire token family if a used token is presented again, which signals theft.