
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.
- Installs
- 387
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/auth0/agent-skills --skill auth0-springboot-api- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads auth0-springboot-api automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Auth0 Spring Boot API Integration
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:
gh api repos/auth0/auth0-auth-java/releases/latest --jq '.tag_name'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.
Prerequisites
- Java 17+ and Spring Boot 3.2+
- Maven 3.6+ or Gradle 7+
- Auth0 API configured (not Application — must be API resource)
- If you don't have Auth0 set up yet, use the
auth0-quickstartskill first
When NOT to Use
| 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 |
Quick Start Workflow
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.
1. Install SDK
Gradle (build.gradle):
implementation 'com.auth0:auth0-springboot-api:1.0.0-beta.1'
Maven (pom.xml):
<dependency>
<groupId>com.auth0</groupId>
<artifactId>auth0-springboot-api</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
2. Create Auth0 API
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 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 (Manual Setup section). Then continue with Step 3.
Quick reference for manual API creation:
# Using Auth0 CLI
auth0 apis create \
--name "My Spring Boot API" \
--identifier https://my-springboot-api
Or create manually in Auth0 Dashboard → Applications → APIs
3. Configure application.yml
auth0:
domain: "your-tenant.auth0.com"
audience: "https://my-springboot-api"
Important: Domain must NOT include https://. The library constructs the issuer URL automatically.
Or use application.properties:
auth0.domain=your-tenant.auth0.com
auth0.audience=https://my-springboot-api
4. Configure Spring Security
@Configuration
@EnableMethodSecurity
public class SecurityConfig {
@Bean
SecurityFilterChain apiSecurity(
HttpSecurity http,
Auth0AuthenticationFilter authFilter
) throws Exception {
return http
.csrf(csrf -> csrf.disable())
.sessionManagement(session ->
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(auth -> auth
.requestMatchers("/api/public").permitAll()
.requestMatchers("/api/protected").authenticated()
.requestMatchers("/api/admin/**").hasAuthority("SCOPE_admin")
.anyRequest().authenticated())
.addFilterBefore(authFilter, UsernamePasswordAuthenticationFilter.class)
.build();
}
}
5. Protect Endpoints
@RestController
@RequestMapping("/api")
public class ApiController {
@GetMapping("/public")
public ResponseEntity<Map<String, Object>> publicEndpoint() {
return ResponseEntity.ok(Map.of("message", "Public endpoint - no token required"));
}
@GetMapping("/protected")
public ResponseEntity<Map<String, Object>> protectedEndpoint(Authentication authentication) {
Auth0AuthenticationToken token = (Auth0AuthenticationToken) authentication;
return ResponseEntity.ok(Map.of(
"user", authentication.getName(),
"email", token.getClaim("email"),
"scopes", token.getScopes()
));
}
}
6. Test API
Agent instruction: After writing all code, verify the build succeeds:
./gradlew bootRunor
./mvnw spring-boot:run. If build fails, diagnose and fix. After 5-6 failed attempts, useAskUserQuestionto get help.
Test public endpoint:
curl http://localhost:8080/api/public
Test protected endpoint (requires access token):
curl http://localhost:8080/api/protected \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Get a test token via Client Credentials flow or Auth0 Dashboard → APIs → Test tab.
Common Mistakes
| 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 |
Scope-Based Authorization
See Integration Guide for defining and enforcing scope-based access control via filter chain, @PreAuthorize, or programmatic checks.
DPoP Support
Built-in proof-of-possession token binding per RFC 9449. See Integration Guide for configuration modes (DISABLED, ALLOWED, REQUIRED).
Related Skills
auth0-quickstart— Basic Auth0 setup and account creationauth0-java— Spring Boot web apps with login UI (Regular Web Application)
Quick Reference
Configuration Properties (application.yml):
auth0.domain— Auth0 tenant domain, nohttps://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 /subclaim)token.getClaim("email")— Any specific claim by nametoken.getClaims()— All JWT claims asMap<String, Object>token.getScopes()— Scopes asSet<String>
Common Use Cases:
- Protect routes →
requestMatchers("/path").authenticated()(see Step 4) - Scope enforcement →
hasAuthority("SCOPE_read:data")or@PreAuthorize(see Integration Guide) - DPoP token binding → Integration Guide
- Complete API reference → API Reference
Detailed Documentation
- Setup Guide — Auth0 CLI automation, environment configuration, secret management
- Integration Guide — Scope policies, DPoP, controller patterns, error handling
- API Reference — Complete configuration options, claims reference, testing checklist
References
FAQ
What does the auth0-springboot-api skill do?
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.
How do I install auth0-springboot-api?
Run npx skills add https://github.com/auth0/agent-skills --skill auth0-springboot-api in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/auth0-springboot-api/ (personal) or .claude/skills/auth0-springboot-api/ (project).
Which AI agents can use auth0-springboot-api?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is auth0-springboot-api safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains auth0-springboot-api?
It is published by auth0 in auth0/agent-skills, and it is an official skill from the maker of the technology it covers. It has 387 recorded installs.
More from auth0/agent-skills
auth0
auth0/agent-skills
Use when adding, fixing, or improving how an app authenticates users or protects an API, or when using or configuring any Auth0 feature — signing users in and out, sessions and tokens, guarding routes and endpoints, MFA, passwordless passkey login (WebAuthn), SSO, Organizations, RBAC, custom domains, Universal Portals for hosted account and organization self-service, or Universal Login branding. Also use to audit a tenant's health, security, and plan fit (CheckMate), to debug why an auth flow fails, to migrate from another auth provider, or to set up the Vercel native integration. Covers any web, mobile, or backend framework and every Auth0 SDK, tool, and API. Use even if the user never mentions Auth0.
auth0-quickstart
auth0/agent-skills
Use when adding Auth0 authentication to any app and unsure which SDK or skill to use. Detects the project's framework and routes to the right setup workflow — use this as the entry point even if the user just says "add login to my app" or "set up Auth0" without naming a framework.
auth0-nextjs
auth0/agent-skills
Use when adding Auth0 login, logout, protected pages, or middleware to a Next.js application. Supports App Router and Pages Router with @auth0/nextjs-auth0 — use even if the user says "add login to my Next.js app" or "protect my Next.js routes".
auth0-react
auth0/agent-skills
Use when adding Auth0 login, logout, protected routes, or user sessions to a React SPA. Integrates @auth0/auth0-react — use even if the user says "add login to my React app" or "protect my React routes" without naming the SDK.
auth0-react-native
auth0/agent-skills
Use when adding Auth0 login, logout, or biometric auth to a bare React Native app (not Expo). Integrates react-native-auth0 with native deep linking.
auth0-express
auth0/agent-skills
Use when adding session-based login, logout, or protected routes to an Express.js web application. Integrates express-openid-connect — use even if the user says "add login to my Express app" or "protect my Express routes".
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.