auth-security

Implement OAuth 2.1 with PKCE and JWT verification for secure authentication.

258|26|Updated Dec 9, 2025
One-click install
npx skills add https://github.com/majiayu000/claude-arsenal --skill auth-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-security
Source: https://github.com/majiayu000/claude-arsenal/tree/main/skills/auth-security
Command: npx skills add https://github.com/majiayu000/claude-arsenal --skill auth-security

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Securely authenticating and authorizing users at scale is complex. This Skill covers OAuth 2.1 (RFC 9700), PKCE, short-lived tokens, and JWT best practices to design robust auth flows.

Core Features & Use Cases

  • OAuth 2.1 + PKCE: Enforces Authorization Code + PKCE with secure token exchange.
  • JWT Best Practices: Explicit algorithm whitelisting, checks on token structure, and secure storage.
  • Token Storage & Rotation: Secure storage patterns, refresh token rotation, and HttpOnly storage guidance.

Quick Start

Draft an OAuth 2.1 flow using PKCE and implement a verifyAccessToken function that validates algorithm, issuer, audience, and expiration.

Frequently Asked Questions about auth-security

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

FAQPage Schema
How do I implement OAuth 2.1 with PKCE for secure user authentication?

OAuth 2.1 with PKCE enforces Authorization Code flow using a code verifier and challenge to prevent authorization code interception. Generate a random code verifier, derive its SHA-256 hash as the challenge, send it during authorization, then exchange the authorization code plus verifier for tokens. This protects mobile and single-page applications from code interception attacks.

What are JWT best practices for access token validation?

JWT validation requires explicit algorithm whitelisting (reject 'none'), verification of issuer and audience claims, expiration time checks, and signature validation using JWKS. Never trust the algorithm header; always whitelist acceptable algorithms server-side. Short-lived tokens with rotation reduce exposure if compromised.

How should I store OAuth tokens securely in web and mobile applications?

Store refresh tokens in HttpOnly, Secure cookies to prevent JavaScript access and XSS theft. Store access tokens in memory or sessionStorage for SPAs. On mobile, use platform-native secure storage. Never store tokens in localStorage; it's vulnerable to XSS attacks and lacks httpOnly protections.

What is refresh token rotation and why is it important?

Refresh token rotation issues a new refresh token with each token refresh and invalidates the previous one. This limits the window of exposure if a refresh token is stolen, forces attackers to use compromised tokens quickly before rotation, and detects token replay attacks when old tokens are reused.

Can OAuth 2.1 protect against common security attacks like token binding and audience confusion?

OAuth 2.1 mitigates token binding by tying tokens to specific clients and resource servers through audience validation. Audience claims must match the resource server's identifier; tokens issued for one API cannot be used on another. Token binding and explicit scope validation prevent tokens from being used in unintended contexts.

What's the difference between OAuth 2.1 and earlier OAuth versions?

OAuth 2.1 consolidates best practices from RFC 6749 and security extensions, mandates PKCE for all public clients, deprecates implicit and resource owner password flows, and strengthens security defaults. It simplifies the spec by removing weaker flows and making token endpoint authentication mandatory for confidential clients.