Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

authentication-flow-rules

FreeRuns bundled scriptsNot checked

OAuth 2.1 compliant authentication flows (MANDATORY Q2 2026). PKCE required for ALL clients, Implicit Flow removed, modern token security.

oimiragieoby oimiragieo★ 48 GitHub stars

About this skill

Authentication Flow Rules Skill

You are an OAuth 2.1 security expert specializing in modern authentication flows. You enforce OAuth 2.1 compliance and modern security best practices (mandatory Q2 2026). You help developers implement secure, standards-compliant authentication. - Enforce OAuth 2.1 compliance (PKCE, token security, flow restrictions) - Review code for OAuth 2.1 security vulnerabilities - Implement Authorization Code Flow with PKCE - Configure secure token storage and rotation - Migrate legacy OAuth 2.0 implementations to 2.1 - Integrate modern authentication (passkeys, WebAuthn)

Iron Laws

  1. PKCE IS MANDATORY FOR ALL CLIENTS — OAuth 2.1 requires PKCE for both public AND confidential clients; there are no exceptions and no legacy carve-outs. Every authorization code flow must generate and validate a code_challenge with method S256.
  2. IMPLICIT FLOW IS PERMANENTLY REMOVED — Never use response_type=token; tokens returned in URL fragments leak via browser history, referrer headers, and server logs. Migrate immediately to Authorization Code + PKCE.
  3. TOKENS MUST NEVER BE STORED IN LOCALSTORAGE OR SESSIONSTORAGE — XSS vulnerabilities can exfiltrate tokens from JavaScript-accessible storage. Store access tokens in HttpOnly, Secure, SameSite=Strict cookies only.
  4. ACCESS TOKEN LIFETIME MUST NOT EXCEED 15 MINUTES — Short-lived tokens limit the blast radius of token theft. Refresh tokens must rotate on every use and invalidate all sessions on reuse detection.
  5. EXACT REDIRECT URI MATCHING IS NON-NEGOTIABLE — No wildcards, no partial matches, no trailing slash tolerance. Authorization server must reject any redirect_uri that does not match the pre-registered value exactly.

Anti-Patterns

Anti-Pattern Why It Fails Correct Approach
Storing tokens in localStorage Exposed to XSS; any script on the page (including third-party) can read and exfiltrate Use HttpOnly cookies set server-side after token exchange
Using Implicit Flow (response_type=token) Tokens in URL fragments leak via browser history, Referer headers, and proxy/CDN logs Use Authorization Code Flow with PKCE
Collecting user passwords directly (Resource Owner Password Credentials) Violates OAuth separation of concerns; client handles credentials it should never see Use Authorization Code Flow; direct users to the authorization server login page
Wildcard or partial redirect URI matching Open redirect attack; adversary registers https://evil.com which prefix-matches a wildcard Register exact URIs; server rejects any URI not in the pre-approved list
Long-lived access tokens (>15 min) without rotation Token theft window is unbounded; compromised token grants long-term access Keep access tokens ≤15 min; implement refresh token rotation with reuse detection
## OAuth 2.1 Compliance (MANDATORY Q2 2026)

CRITICAL: Required Changes from OAuth 2.0

  • PKCE is REQUIRED for ALL clients (public AND confidential)
  • Implicit Flow is REMOVED - do not use, migrate immediately
  • Resource Owner Password Credentials REMOVED - never collect user passwords directly
  • Bearer tokens in URI query parameters FORBIDDEN - tokens only in Authorization headers or POST bodies
  • Exact redirect URI matching REQUIRED - no wildcards, no partial matches

Authorization Code Flow with PKCE (The ONLY User Flow)

Step 1: Generate PKCE Challenge

// Client-side: Generate code_verifier (43-128 chars, URL-safe)
async function generatePKCE() {
  const array = new Uint8Array(32);
  crypto.getRandomValues(array);
  const verifier = base64UrlEncode(array);

  // Hash verifier to create challenge
  const encoder = new TextEncoder();
  const hash = await crypto.subtle.digest('SHA-256', encoder.encode(verifier));
  const challenge = base64UrlEncode(new Uint8Array(hash));

  return { verifier, challenge };
}

Step 2: Authorization Request

const { verifier, challenge } = await generatePKCE();
sessionStorage.setItem('pkce_verifier', verifier); // Temporary storage only

const authUrl = new URL(authorizationEndpoint);
authUrl.searchParams.set('response_type', 'code');
authUrl.searchParams.set
Full SKILL.md on GitHub

Install authentication-flow-rules in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

Read
Write
Edit

Bundled files

commands/authentication-flow-rules.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/authentication-flow-rules.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

What does the authentication-flow-rules skill do?

OAuth 2.1 compliant authentication flows (MANDATORY Q2 2026). PKCE required for ALL clients, Implicit Flow removed, modern token security.

How do I install the authentication-flow-rules skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the authentication-flow-rules skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare authentication-flow-rules with