> oauth2-oidc
Assists with implementing OAuth 2.0 and OpenID Connect for secure authentication and authorization. Use when configuring authorization flows, validating tokens, implementing PKCE for public clients, setting up social login, or building secure token handling for SPAs, mobile apps, and APIs. Trigger words: oauth, oidc, openid connect, authorization code, pkce, jwt, access token, refresh token.
curl "https://skillshub.wtf/TerminalSkills/skills/oauth2-oidc?format=md"OAuth 2.0 / OpenID Connect
Overview
OAuth 2.0 is the industry standard for API authorization, and OpenID Connect (OIDC) extends it for user authentication. Together they provide Authorization Code + PKCE for secure token exchange, JWT-based identity tokens, refresh token rotation, and integration with identity providers (Auth0, Okta, Keycloak, Google, Azure AD) for social login and enterprise SSO.
Instructions
- When implementing authentication, use the Authorization Code + PKCE flow for all client types (SPAs, mobile, server) since it is the only secure flow; never use the deprecated Implicit or Resource Owner Password flows.
- When validating tokens on the API side, verify the JWT signature using the provider's JWKS endpoint, check
exp,iss, andaudclaims, and never trust client-side token validation alone. - When storing tokens in web apps, use
httpOnly,secure,sameSite=laxcookies; never store tokens in localStorage since it is vulnerable to XSS. - When managing token lifecycle, use short-lived access tokens (5-15 minutes) with refresh token rotation where each refresh token is single-use and a new one is issued with each refresh.
- When integrating a provider, use the discovery endpoint (
/.well-known/openid-configuration) for auto-configuration rather than hardcoding endpoints. - When implementing logout, revoke the refresh token, clear the session, and redirect to the provider's logout endpoint for complete session termination.
Examples
Example 1: Add social login to a Next.js app with PKCE
User request: "Implement Google and GitHub login for my Next.js app using OAuth 2.0"
Actions:
- Configure the OIDC providers with client IDs and redirect URIs
- Implement the Authorization Code + PKCE flow with state and nonce validation
- Exchange the code for tokens and validate the ID token JWT claims
- Store the session in httpOnly cookies with refresh token rotation
Output: A Next.js app with secure social login via Google and GitHub, PKCE-protected token exchange, and httpOnly cookie sessions.
Example 2: Secure a REST API with JWT validation
User request: "Add OAuth 2.0 token validation to my API endpoints"
Actions:
- Fetch the provider's JWKS from the discovery endpoint
- Create middleware that validates the access token signature, expiration, issuer, and audience
- Extract user claims and custom scopes from the validated token
- Return 401 for invalid tokens and 403 for insufficient scopes
Output: An API with JWT-based authorization that validates tokens against the provider's JWKS and enforces scope-based access control.
Guidelines
- Always use Authorization Code + PKCE since it is the only secure flow for all client types.
- Validate tokens on the API side: verify signature,
exp,iss, andaud; never trust client-side validation alone. - Use
httpOnly,secure,sameSite=laxcookies for token storage in web apps, not localStorage. - Implement refresh token rotation where each refresh token is single-use.
- Use the provider's discovery endpoint for configuration rather than hardcoding endpoints.
- Request minimum scopes needed:
openid emailfor login, not all available scopes. - Implement proper logout: revoke refresh token, clear session, redirect to provider's logout endpoint.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.