auth0
Auth0 Integration Skill
This skill provides standard patterns for integrating Auth0 into a polyglot stack. It focuses on secure OIDC flows, JWT verification in Go, and efficient React state management.
Architectural Standards
1. Go Backend Integration (JWT Validation)
- Verification: Use
auth0/go-jwt-middlewareandform3tech-oss/jwt-go. - JWKS Cache: Implement a caching mechanism for public keys from the
.well-known/jwks.jsonendpoint to reduce latency. - Claims Mapping: Map Auth0's
https://yourdomain.com/rolescustom claims to internal Go RBAC structures. Validate theaud(Audience) andiss(Issuer) claims strictly.
2. React Frontend Integration
- SDK: Use
@auth0/auth0-react. Wrap the application root inAuth0Provider. - Silent Refresh: Implement
getAccessTokenSilentlywithuseAuth0. UseignoreCache: trueonly when a fresh token is absolutely required for mutation. - Multi-tenant: Handle
organizationparameters in the login flow if using Auth0 Organizations.
3. TanStack Query Integration
const { getAccessTokenSilently, isAuthenticated } = useAuth0();
const useSecureQuery = (key: any[], fetcher: (token: string) => Promise<any>) => {
return useQuery({
queryKey: key,
queryFn: async () => {
if (!isAuthenticated) throw new Error("Not authenticated");
const token = await getAccessTokenSilently();
return fetcher(token);
},
enabled: isAuthenticated,
});
};
4. Advanced Security
- PKCE: Always ensure Authorization Code Flow with PKCE is enabled for SPAs.
- CORS & Redirects: Strictly white-list only production and trusted dev URLs (e.g.,
http://localhost:5173). - MFA: Handle "MFA Required" errors in the frontend by prompting the user to complete the Auth0 MFA challenge.
Interaction Protocol
- Input: Auth0 Domain, Client ID, Audience, and architectural requirements.
- Output: Go middleware logic and React TanStack Query integration code.
Tag: Start your response with [AUTH0-INTEGRATION].
More from inselfcontroll/ai-agent-skills
rust_dioxus_framework
Acts as a Rust Dioxus Framework Specialist for building cross-platform UIs. Use when building desktop, web, or mobile apps using the Dioxus framework.
15clerk
Expert for Clerk authentication integration. Use when setting up Clerk in React, implementing Clerk Go middleware for session validation, or managing Clerk user profiles.
2testing_qa
Acts as a Testing and QA Agent. Use when writing unit, integration, or E2E tests, or when auditing code for test coverage.
2code-review
Expert for codebase-wide code reviews. Use when auditing Pull Requests, refactoring complex logic, or enforcing architectural and security standards across the ecosystem.
2principal_architect
Acts as a Principal Software Architect to design blueprints and enforce architectural rules. Use when designing system architecture, defining API contracts, or planning data flows.
2requirements_analyst
Acts as a Requirements Analyst to translate requests into specifications. Use when gathering user requirements, defining user stories, or creating technical specifications.
2