skills/authentication-patterns/SKILL.md
Use when implementing auth - OAuth 2.0, JWT, session management, API keys, RBAC, or reviewing auth security
npx skillsauth add kienbui1995/magic-powers authentication-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Auth is the most security-critical part of any application. Use proven patterns, never roll your own crypto.
| Pattern | Best For | Avoid When | |---------|----------|------------| | Session + cookie | Server-rendered web apps | Mobile/SPA without same-origin | | JWT (access + refresh) | SPAs, mobile apps, microservices | Simple server-rendered apps | | OAuth 2.0 + OIDC | Social login, SSO, third-party auth | Internal-only tools | | API keys | Server-to-server, public APIs | User-facing auth |
1. Client generates code_verifier + code_challenge
2. Redirect to /authorize?response_type=code&code_challenge=...
3. User authenticates with provider
4. Provider redirects back with authorization code
5. Client exchanges code + code_verifier for tokens
6. Store access token in memory, refresh token in httpOnly cookie
httpOnly, secure, sameSite=strictcontent-media
Use when designing for XR (AR/VR/MR), choosing interaction modes, or adapting 2D UI patterns for spatial computing
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment
development
Use when you have a spec or requirements for a multi-step task, before touching code
development
Use when executing a structured workflow — select and run a feature, bugfix, refactor, research, or incident template with correct agent and model assignments per phase.