oauth2-authentication▌
manutej/luxor-claude-marketplace · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
A comprehensive skill for implementing secure authentication and authorization using OAuth2 and OpenID Connect. This skill covers all major authorization flows, token management strategies, security best practices, and real-world implementation patterns for web, mobile, and API applications.
OAuth2 Authentication
A comprehensive skill for implementing secure authentication and authorization using OAuth2 and OpenID Connect. This skill covers all major authorization flows, token management strategies, security best practices, and real-world implementation patterns for web, mobile, and API applications.
When to Use This Skill
Use this skill when:
- Implementing user authentication in web applications, SPAs, or mobile apps
- Building API authorization with access tokens and refresh tokens
- Integrating social login (Google, GitHub, Facebook, Twitter, etc.)
- Creating secure machine-to-machine (M2M) authentication
- Implementing single sign-on (SSO) across multiple applications
- Building an OAuth2 authorization server or identity provider
- Adding delegated authorization to allow third-party access
- Securing APIs with token-based authentication
- Implementing passwordless authentication flows
- Adding multi-tenant authentication with organization-specific rules
- Migrating from session-based to token-based authentication
- Implementing fine-grained access control with OAuth2 scopes
Core Concepts
OAuth2 Fundamentals
OAuth2 is an authorization framework that enables applications to obtain limited access to user accounts on an HTTP service. It works by delegating user authentication to the service that hosts the user account and authorizing third-party applications to access that account.
Key Terminology:
- Resource Owner: The user who owns the data or resources
- Client: The application requesting access to resources (web app, mobile app, SPA)
- Authorization Server: Issues access tokens after authenticating the resource owner
- Resource Server: Hosts protected resources, accepts and validates access tokens
- Access Token: Short-lived credential used to access protected resources
- Refresh Token: Long-lived credential used to obtain new access tokens
- Scope: Permission granted to access specific resources or perform actions
- Authorization Code: Temporary code exchanged for an access token
- State Parameter: Prevents CSRF attacks during authorization flow
- Redirect URI: Callback URL where the user is redirected after authorization
OAuth2 Grant Types (Authorization Flows)
OAuth2 defines several grant types for different use cases:
1. Authorization Code Flow
Most Secure Flow - Recommended for Server-Side Applications
The authorization code flow is the most secure and widely used OAuth2 flow. It involves exchanging an authorization code for an access token on the server side.
Flow Steps:
- Client redirects user to authorization server with client_id, redirect_uri, scope, and state
- User authenticates and consents to requested permissions
- Authorization server redirects back to client with authorization code
- Client exchanges code for access token using client secret (server-side)
- Client uses access token to access protected resources
When to Use:
- Traditional server-side web applications
- Applications that can securely store client secrets
- When you need maximum security
- When refresh tokens are required
Security Benefits:
- Access token never exposed to browser
- Client authentication via client secret
- Authorization code is single-use and short-lived
- State parameter prevents CSRF attacks
2. Authorization Code Flow with PKCE
Secure Flow for Public Clients (SPAs and Mobile Apps)
PKCE (Proof Key for Code Exchange, pronounced "pixy") is an extension to the authorization code flow designed for public clients that cannot securely store client secrets.
Flow Steps:
- Client generates code_verifier (random string) and code_challenge (SHA256 hash)
- Client redirects to authorization server with code_challenge
- User authenticates and consents
- Authorization server returns authorization code
- Client exchanges code + code_verifier for access token
- Server validates code_verifier matches code_challenge
When to Use:
- Single Page Applications (SPAs)
- Mobile applications (iOS, Android)
- Desktop applications
- Any public client that cannot store secrets
Security Benefits:
- Prevents authorization code interception attacks
- No client secret required
- Protects against malicious apps intercepting redirect
- Recommended by OAuth2 security best practices (RFC 8252)
3. Client Credentials Flow
Machine-to-Machine Authentication
The client credentials flow is used when the client itself is the resource owner, typically for service-to-service communication.
Flow Steps:
- Client authenticates with client_id and client_secret
- Authorization server validates credentials
- Authorization server issues access token
- Client uses token to access protected resources
When to Use:
- Backend services communicating with APIs
- Cron jobs or scheduled tasks
- Microservices authentication
- CI/CD pipelines accessing APIs
- System-level operations without user context
Characteristics:
- No user involvement
- Client is the resource owner
- No refresh tokens (just request new access token)
- Typically long-lived or cached tokens
4. Implicit Flow (Deprecated)
Legacy Flow - No Longer Recommended
The implicit flow returns tokens directly in the URL fragment without an authorization code exchange. This flow is now considered insecure and should be avoided.
Why Deprecated:
- Access tokens exposed in browser history
- No client authentication
- No refresh token support
- Vulnerable to token theft
- Use Authorization Code Flow with PKCE instead
5. Resource Owner Password Credentials (ROPC)
Legacy Flow - Avoid Unless Necessary
The resource owner password credentials flow allows the client to collect username and password directly, then exchange them for tokens.
Flow Steps:
- User provides username and password to client
- Client sends credentials to authorization server
- Authorization server validates and issues tokens
When to Use (Rarely):
- First-party mobile apps migrating from legacy authentication
- Trusted first-party applications only
- When no browser/redirect flow is possible
Why to Avoid:
- Client handles user credentials directly (security risk)
- No multi-factor authentication support
- Phishing vulnerability
- Violates OAuth2 principle of delegated authorization
- Use Authorization Code Flow with PKCE instead when possible
6. Device Authorization Flow
For Input-Constrained Devices
The device flow is designed for devices with limited input capabilities (smart TVs, IoT devices, CLI tools).
Flow Steps:
- Device requests device code and user code from authorization server
- Device displays user code and instructs user to visit URL
- User visits URL on another device and enters user code
- User authenticates and authorizes device
- Device polls authorization server for access token
- Authorization server issues access token when user completes authorization
When to Use:
- Smart TVs and streaming devices
- IoT devices without keyboards
- CLI tools and command-line applications
- Gaming consoles
- Any device where typing is difficult
Token Types and Management
Access Tokens
Short-lived credentials for accessing protected resources
Characteristics:
- Typically expire in 15 minutes to 1 hour
- Bearer token format:
Authorization: Bearer <access_token> - Can be opaque tokens or JWTs (JSON Web Tokens)
- Should be treated as sensitive credentials
- Never log or expose in URLs
- Validate on every API request
JWT Structure (when using JWTs):
Header.Payload.Signature
JWT Payload Claims:
sub: Subject (user ID)iat: Issued at timeexp: Expiration timeiss: Issuer (authorization server)aud: Audience (resource server)scope: Granted permissions- Custom claims (user metadata, roles, etc.)
Token Validation:
- Verify signature using public key
- Check expiration (exp claim)
- Verify issuer (iss claim)
- Validate audience (aud claim)
- Check token has required scopes
Refresh Tokens
Long-lived credentials for obtaining new access tokens
Characteristics:
- Typically expire in days, weeks, or months
- Single-use or reusable (depending on implementation)
- Must be stored securely (never in localStorage in browsers)
- Should be encrypted at rest
- Can be revoked by authorization server
- Subject to rotation policies
Refresh Token Rotation:
- Each refresh issues a new refresh token
- Old refresh token is invalidated
- Prevents token replay attacks
- Detects token theft (multiple refresh attempts)
- Recommended security practice
Token Storage Best Practices:
Web Applications:
- Access tokens: Memory (React context, Vuex, Redux)
- Refresh tokens: HttpOnly, Secure, SameSite cookies
- Alternative: Store refresh token on backend, use session
Mobile Applications:
- Use platform secure storage
- iOS: Keychain Services
- Android: EncryptedSharedPreferences or Keystore
- Never store in plaintext files
SPAs:
- Store access tokens in memory only
- Use BFF (Backend for Frontend) pattern for refresh tokens
- Consider Token Handler pattern
- Avoid localStorage (XSS vulnerability)
ID Tokens (OpenID Connect)
Tokens containing user identity information
Characteristics:
- Always JWT format
- Contains user profile information
- Used for authentication (not authorization)
- Returned alongside access tokens
- Should be validated before use
Standard Claims:
sub: Subject (unique user ID)name: Full nameemail: Email addressemail_verified: Email verification statuspicture: Profile picture URLiat,exp: Issued/expiration times
OAuth2 Scopes
Fine-grained permissions for access control
Scopes define what access the client is requesting and what the access token permits.
Scope Naming Conventions:
read:users- Read user datawrite:users- Create/update usersdelete:users- Delete usersadmin:all- Full administrative accessopenid- Request OpenID Connect ID tokenprofile- Access user profile informationemail- Access user email address
Best Practices:
- Request minimum required scopes (principle of least privilege)
- Separate read and write permissions
- Create resource-specific scopes
- Document all available scopes
- Allow users to see and understand requested permissions
- Implement scope-based access control in APIs
Dynamic Scopes:
read:organization:{org_id}
write:project:{project_id}
admin:tenant:{tenant_id}
Security Considerations
State Parameter
Prevents Cross-Site Request Forgery (CSRF)
The state parameter is a random value that the client includes in the authorization request and validates in the callback.
Implementation:
- Generate random state value (cryptographically secure)
- Store state in session or encrypted cookie
- Include state in authorization URL
- Validate state matches when receiving callback
- Reject mismatched or missing state
Example State Value:
state: crypto.randomBytes(32).toString('hex')
// "7f8a3d9e2b1c4f5a6d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
PKCE Implementation
Proof Key for Code Exchange - Prevents Code Interception
PKCE protects the authorization code flow against authorization code interception attacks.
Code Verifier:
- Random string, 43-128 characters
- Characters: A-Z, a-z, 0-9, -, ., _, ~
- Stored securely on client
Code Challenge:
- SHA256 hash of code verifier (recommended)
- Or plain code verifier (not recommended)
- Sent in authorization request
Code Challenge Methods:
S256: SHA256 hash (use this)plain: Plaintext verifier (legacy only)
Implementation Example:
// Generate code verifier
const codeVerifier = generateRandomString(64);
// Generate code challenge
const codeChallenge = base64UrlEncode(
sha256(codeVerifier)
);
// Store code verifier for token exchange
sessionStorage.setItem('code_verifier', codeVerifier);
// Include in authorization URL
const authUrl = `${authEndpoint}?` +
`client_id=${clientId}` +
`&redirect_uri=${redirectUri}` +
`&response_type=code` +
`&scope=${scopes}` +
`&state=${state}` +
`&code_challenge=${codeChallenge}` +
`&code_challenge_method=S256`;
Token Security
Protecting Access and Refresh Tokens
Do:
- Use HTTPS for all OAuth2 endpoints
- Store refresh tokens in secure storage only
- Implement token rotation
- Set appropriate token expiration times
- Validate tokens on every API request
- Use JWTs with strong signing algorithms (RS256, ES256)
- Implement token revocation
- Monitor for suspicious token usage
Don't:
- Store tokens in localStorage (XSS risk)
- Include tokens in URLs or query parameters
- Log tokens in application logs
- Use weak signing algorithms (HS256 with shared secrets)
- Share tokens between applications
- Extend access token lifetime unnecessarily
- Ignore token expiration
Redirect URI Validation
Prevent Open Redirect Vulnerabilities
Strict Validation Rules:
- Exact match required (no wildcards)
- Protocol must match exactly (https://)
- Host must match exactly
- Port must match (if specified)
- Path must match (if specified)
- Register all redirect URIs in advance
Mobile Deep Links:
- Use custom URL schemes:
com.example.app://callback - Or universal links (iOS):
https://example.com/auth/callback - Or app links (Android):
https://example.com/auth/callback - Register schemes with authorization server
Localhost Development:
- Allow http://localhost for development only
- Specify exact port:
http://localhost:3000/callback - Use 127.0.0.1 if localhost doesn't work
- Never use localhost redirects in production
OpenID Connect (OIDC)
Identity Layer Built on OAuth2
OpenID Connect adds an identity layer on top of OAuth2, providing authentication in addition to authorization.
Key Differences from OAuth2:
- Returns ID token in addition to access token
- ID token contains user identity information
- Standardized user info endpoint
- Standardized discovery endpoint (.well-known/openid-configuration)
- Session management capabilities
OIDC Flows:
-
Authorization Code Flow (recommended)
- Same as OAuth2 but returns id_token
- Most secure for web apps
-
Implicit Flow (deprecated)
- Returns id_token directly
- Insecure, use Code Flow with PKCE instead
-
Hybrid Flow
- Combines Code and Implicit flows
- Complex, rarely needed
OIDC Scopes:
openid(required) - Enables OIDCprofile- Name, picture, locale, etc.email- Email address and verification statusaddress- Physical addressphone- Phone number
UserInfo Endpoint:
GET /userinfo
Authorization: Bearer <access_token>
How to use oauth2-authentication on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add oauth2-authentication
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches oauth2-authentication from GitHub repository manutej/luxor-claude-marketplace and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate oauth2-authentication. Access the skill through slash commands (e.g., /oauth2-authentication) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★49 reviews- ★★★★★Xiao Verma· Dec 24, 2024
Useful defaults in oauth2-authentication — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Isabella Mensah· Dec 16, 2024
We added oauth2-authentication from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Neel Bansal· Dec 16, 2024
I recommend oauth2-authentication for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Jin Rahman· Dec 12, 2024
Registry listing for oauth2-authentication matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Diego Verma· Dec 8, 2024
Solid pick for teams standardizing on skills: oauth2-authentication is focused, and the summary matches what you get after install.
- ★★★★★Diego Robinson· Nov 27, 2024
oauth2-authentication has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Neel Singh· Nov 15, 2024
oauth2-authentication is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Noor Li· Nov 7, 2024
oauth2-authentication fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Dev Khan· Nov 3, 2024
oauth2-authentication reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Neel Verma· Oct 26, 2024
oauth2-authentication has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 49