npx skills add ...
npx skills add auth0/agent-skills --skill auth0-springboot-api
npx skills add auth0/agent-skills --skill auth0-springboot-api
Use when protecting Spring Boot API endpoints with JWT Bearer token validation, scope-based authorization, or DPoP binding. Integrates com.auth0:auth0-springboot-api for REST APIs receiving access tokens.
Protect Spring Boot API endpoints with JWT access token validation using com.auth0:auth0-springboot-api. Features auto-configuration, scope-based authorization, and built-in DPoP (RFC 9449) support.
Agent instruction: Before providing SDK setup instructions, fetch the latest release version by running:
Use the returned version in all dependency lines instead of any hardcoded version below. If the API call fails (e.g., no releases yet), use
1.0.0-beta.1.
auth0-quickstart skill first| Use Case | Recommended Skill |
|---|---|
| Server-rendered web applications (Spring MVC with sessions) | Use auth0-java for Spring Boot web apps with login UI |
| Single Page Applications | Use auth0-react, auth0-vue, or auth0-angular for client-side auth |
| Mobile applications | Use auth0-android or auth0-swift for native mobile |
| Non-Spring Java APIs | Use auth0-spring-security-api for plain Spring Security |
Agent instruction: If the user's prompt already provides Auth0 credentials (domain, audience), use them directly — skip the bootstrap script and credential questions. Only offer setup options when credentials are missing.
Gradle (build.gradle):
Maven (pom.xml):
You need an API (not Application) in Auth0.
STOP — ask the user before proceeding.
Ask exactly this question and wait for their answer before doing anything else:
"How would you like to create the Auth0 API resource?
- Automated — I'll run Auth0 CLI scripts that create the resource and write the values to your application.yml automatically.
- Manual — You create the API yourself in the Auth0 Dashboard (or via
auth0 apis create) and provide me the Domain and Audience.Which do you prefer? (1 = Automated / 2 = Manual)"
Do NOT proceed to any setup steps until the user has answered. Do NOT default to manual.
If the user chose Automated, follow the Setup Guide [blocked] for complete CLI scripts. The automated path writes application.yml for you — skip Step 3 below and proceed directly to Step 4.
If the user chose Manual, follow the Setup Guide [blocked] (Manual Setup section). Then continue with Step 3.
Quick reference for manual API creation:
Or create manually in Auth0 Dashboard → Applications → APIs
Important: Domain must NOT include https://. The library constructs the issuer URL automatically.
Or use application.properties:
Agent instruction: After writing all code, verify the build succeeds:
or
./mvnw spring-boot:run. If build fails, diagnose and fix. After 5-6 failed attempts, useAskUserQuestionto get help.
Test public endpoint:
Test protected endpoint (requires access token):
Get a test token via Client Credentials flow or Auth0 Dashboard → APIs → Test tab.
| Mistake | Fix |
|---|---|
Domain includes https:// | Use your-tenant.auth0.com format only — no scheme prefix |
| Audience doesn't match API Identifier | Must exactly match the API Identifier set in Auth0 Dashboard |
| Created Application instead of API in Auth0 | Must create API resource in Auth0 Dashboard → Applications → APIs |
Missing addFilterBefore in SecurityConfig | Auth0AuthenticationFilter must be added before UsernamePasswordAuthenticationFilter |
| Using ID token instead of access token | Must use access token for API auth, not ID token |
Checking scope claim in wrong format | Scopes map to SCOPE_ prefixed authorities: use hasAuthority("SCOPE_read:data") |
| Spring Boot env var binding | Use AUTH0_DOMAIN not AUTH0_DOMAIN with underscores inside property names; Spring removes dashes and is case-insensitive |
See Integration Guide [blocked] for defining and enforcing scope-based access control via filter chain, @PreAuthorize, or programmatic checks.
Built-in proof-of-possession token binding per RFC 9449. See Integration Guide [blocked] for configuration modes (DISABLED, ALLOWED, REQUIRED).
auth0-quickstart — Basic Auth0 setup and account creationauth0-java — Spring Boot web apps with login UI (Regular Web Application)Configuration Properties (application.yml):
auth0.domain — Auth0 tenant domain, no https:// prefix (required)auth0.audience — API Identifier from Auth0 API settings (required)auth0.dpop-mode — DPoP mode: DISABLED, ALLOWED (default), REQUIREDauth0.dpop-iat-offset-seconds — DPoP proof time window (default: 300)auth0.dpop-iat-leeway-seconds — DPoP proof time leeway (default: 30)User Claims (via Auth0AuthenticationToken):
authentication.getName() — User ID (subject / sub claim)token.getClaim("email") — Any specific claim by nametoken.getClaims() — All JWT claims as Map<String, Object>token.getScopes() — Scopes as Set<String>Common Use Cases:
requestMatchers("/path").authenticated() (see Step 4)hasAuthority("SCOPE_read:data") or @PreAuthorize (see Integration Guide [blocked])