关于 auth0
Auth0 skill 根据开发者的身份验证需求和项目框架,选择相关参考资料,涵盖集成、功能配置、安全审查与故障排查。它也支持 Auth0 CLI 和 SDK 迁移等任务。
主要功能
- 01识别身份验证意图与框架
- 02按需加载功能参考资料
- 03覆盖 MFA、通行密钥与组织
- 04指导安全审查和健康检查
- 05支持故障排查、迁移与 CLI
适用场景
- 01为应用添加 Auth0 登录
- 02配置 MFA 或通行密钥
- 03审查租户安全与运行状况
- 04排查认证错误或迁移身份提供方
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ auth0/ agent-skills --skill auth0安装后在 Claude Code 中输入/auth0确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
agents/openai.yamlassets/acul/js-templates/login-id.jslogin-password.jsassets/acul/react-templates/login-id.tsxlogin-password.tsxassets/acul/theme-templates/globals.csstailwind.config.tstheme-provider.tstokens.cssassets/audit/report-template.htmlreport-template.mdassets/healthcheck/report-template.htmlreport-template.mdreferences/feature-acul/index.mdreferences/feature-audit-pricing/index.mdreferences/feature-audit-remediation/index.mdreferences/feature-audit/index.mdreferences/feature-branding/index.mdreferences/feature-custom-domains/index.mdreferences/feature-custom-token-exchange/auth0-android.mdauth0-api-python.mdauth0-auth-js.mdauth0-react.mdauth0-server-js.mdauth0-server-python.mdauth0-spa-js.mdauth0-swift.mdindex.mdnextjs-auth0.mdreact-native-auth0.md详细介绍
Auth0
检测意图 → 检测框架 → 检测工具 → 加载 2–3 个参考文件。
步骤 1:检测意图
将请求与 开发者想要的内容 列进行匹配——该列用通俗语言描述目标,而不只是 Auth0 术语。你选择的 意图 是一个查找键:在 步骤 4 中,它会原样出现在一个章节标题中(### feature:mfa),该标题会列出要加载的参考文件。
| 开发者的需求(通俗表述 + Auth0 术语) | 意图 |
|---|---|
| 在应用中添加登录、注册、登录功能、“让用户登录 / 创建账户”,或以其他方式在应用或脚本中添加并使用 Auth0 SDK | integrate |
| 在密码之后增加第二步验证 — 一次性代码、短信或电子邮件验证码、身份验证器应用,或作为额外因素使用的通行密钥 / 指纹 / 面容 / 安全密钥;或者在执行敏感操作前重新确认身份。Auth0:多因素身份验证(MFA)、双因素身份验证(2FA)、两步验证、逐步身份验证。 | feature:mfa |
| 让用户使用通行密钥、指纹或 Face ID 注册或登录,而不是使用密码 — 将无密码 WebAuthn 作为主要凭据 — 或让已登录用户向其账户添加通行密钥。Auth0:通行密钥、WebAuthn、无密码登录。 | feature:passkeys |
| 让不同的公司、团队、工作区或租户各自拥有自己的用户、成员、角色和登录方式 — 通常是面向企业销售的产品。Auth0:Organizations、多组织、B2B SaaS。 | feature:organizations |
| 部署托管的自助服务门户,用于管理个人资料、通行密钥、MFA 或组织详情,而不是自行构建“My Account”或“My Organization”界面。Auth0:Universal Portals、My Account portal、My Organization portal。 | feature:universal-portals |
使用自己的网址提供登录页面(例如 login.example.com、auth.company.com),而不是使用默认的 Auth0 网址。Auth0:自定义域名。 | feature:custom-domains |
| 使用自己的代码或框架构建完全自定义的登录 / 注册页面,超出主题设置允许的范围。Auth0:Universal Login 高级自定义(ACUL)。 | feature:acul |
| 更改登录页面的外观 — 徽标、颜色、字体、背景和整体主题。Auth0:品牌、Universal Login 自定义。 | feature:branding |
| 将令牌绑定到客户端,以防被盗或泄露的令牌从另一台机器上重复使用 / 重放。Auth0:DPoP(持有证明)、发送方约束令牌。 | feature:dpop |
| 将外部或合作伙伴令牌(旧系统、MCP/Agent 或其他 IdP)交换为 Auth0 令牌,无需交互式登录。Auth0:自定义令牌交换(CTE)、RFC 8693、subject_token。 | feature:custom-token-exchange |
| 审计租户的安全 / 配置问题,生成报告,然后可选择修复发现的问题。Auth0:租户审计、CheckMate。 | audit |
| 检查租户是否健康、所用套餐是否合适 — 提供两个评分和一条建议。Auth0:健康检查。 | healthcheck |
| 咨询最佳实践、“这样安全吗?”、如何安全处理令牌、“我该如何做 X”。Auth0:指导 / 安全。 | guidance |
| 遇到错误:401 Unauthorized、403 Forbidden、CORS、回调 URL 不匹配、重定向循环。Auth0:调试。 | debug |
| 遇到速率限制:429 Too Many Requests、超出配额。Auth0:速率限制。 | debug:rate-limit |
| 将现有应用从 Clerk、NextAuth.js、Firebase、Cognito、Okta、Supabase、Passport.js 或其他身份验证提供商迁移出来。Auth0:提供商迁移。 | migrate |
| 将 Auth0 SDK 本身升级到新的主版本(例如,Auth0.swift v2→v3、Auth0.Android v3→v4)— 破坏性变更、已弃用的 API、“更新到最新 SDK”。Auth0:SDK 主版本升级。 | upgrade-sdk |
| 安装 Auth0 的 Vercel Marketplace 集成,将 Auth0 连接到 Vercel 项目,或将 Auth0 配置同步到托管在 Vercel 上的 Next.js 应用。Auth0:Vercel 原生集成。 | integrate |
直接使用 Auth0 CLI —“使用 auth0 CLI 创建应用 / API”,编写租户设置脚本,或在 CI 中自动化 Auth0 配置 — 不涉及应用框架。Auth0:CLI / 仅工具。 | tooling |
如果没有明显匹配项
选择最接近的目标。如果目标确实不明确,请询问开发者想要实现什么 — 不要猜测意图。
步骤 2:检测框架
对于
tooling意图,跳过此步骤——以 CLI 为先的请求不涉及框架。 转到步骤 3,加载 tooling 参考;只有当开发者之后转而询问如何将 身份验证集成到应用中时,才询问框架。
从上到下检查。找到第一个能确定框架的层级后即停止。
层级 1 — 已安装 Auth0 SDK(最强信号)
Node.js / JavaScript / TypeScript — 检查 package.json → dependencies
表格行按具体程度从高到低排列:Ionic/Capacitor 项目也会包含基础 SDK,
因此请先检查 @capacitor/browser 对应的行。
| 软件包 | 框架 |
|---|---|
@capacitor/browser + @auth0/auth0-angular | ionic-angular |
@capacitor/browser + @auth0/auth0-react | ionic-react |
@capacitor/browser + @auth0/auth0-vue | ionic-vue |
@auth0/nextjs-auth0 | nextjs |
@auth0/auth0-nuxt | nuxt |
@auth0/auth0-tanstack-start-react | tanstack-start |
@auth0/auth0-react | react |
@auth0/auth0-vue | vue |
@auth0/auth0-angular | angular |
@auth0/auth0-spa-js | spa-js |
express-openid-connect | express |
@auth0/auth0-fastify | fastify |
@auth0/auth0-fastify-api | fastify-api |
express-oauth2-jwt-bearer | express-jwt |
react-native-auth0 + 存在 app.json 或 app.config.js | expo |
react-native-auth0(无 Expo 文件) | react-native |
@auth0/auth0-api-js | auth0-api-js |
@auth0/auth0-server-js | auth0-server-js |
@auth0/auth0-auth-js | auth0-auth-js |
auth0(不带作用域的包,不是 @auth0/*) | node-auth0 |
Python — 检查 requirements.txt 或 pyproject.toml
表格行按具体程度从高到低排列:auth0-server-python 是与框架无关的
服务端核心,因此请先检查是否同时安装了 Web 框架,再回退到单独的 SDK 行。
| 软件包 | 框架 |
|---|---|
auth0-server-python + flask | flask |
auth0-server-python(无 Flask Web 框架) | server-python |
auth0-fastapi-api | fastapi-api |
auth0-api-python | api-python |
Java / Kotlin — 检查 build.gradle 或 pom.xml
| 依赖项 | 框架 |
|---|---|
mvc-auth-commons(com.auth0:mvc-auth-commons) | java-mvc |
spring-security-oauth2-resource-server | springboot-api |
.NET — 检查 *.csproj 或 NuGet.Config
| 软件包 | 框架 |
|---|---|
Auth0.AspNetCore.Authentication(不带 .Api 后缀) | aspnetcore-auth |
Auth0.AspNetCore.Authentication.Api | aspnetcore-api |
Auth0.OidcClient.MAUI | maui |
Auth0.OidcClient.AndroidX | net-android |
Auth0.OidcClient.iOS | net-ios |
Auth0.OidcClient.WinForms | winforms |
Auth0.OidcClient.WPF | wpf |
PHP — 检查 composer.json
auth0/auth0-php 通过 SdkConfiguration 的
strategy 同时支持 PHP Web 应用和 API。STRATEGY_API 行更具体——请先检查。
| 软件包 | 框架 |
|---|---|
auth0/auth0-php + SdkConfiguration::STRATEGY_API(或 strategy: 'api') | php-api |
auth0/auth0-php(无 STRATEGY_API / STRATEGY_REGULAR,或 strategy: 'webapp') | php |
auth0/login(laravel,无 AuthorizationGuard) | laravel |
auth0/login + AuthorizationGuard | laravel-api |
如果已安装
auth0/auth0-php,但尚未设置SdkConfiguration策略 (新建项目),请继续检查下方的变体区分部分。
Go — 检查 go.mod
| 模块 | 框架 |
|---|---|
github.com/auth0/go-jwt-middleware | go |
移动端(原生)
| 信号 | 框架 |
|---|---|
build.gradle(.kts) + com.auth0.kmp:auth0(Kotlin Multiplatform 模块) | kmp |
Package.swift 或 .xcodeproj + Auth0.swift | swift |
build.gradle + com.auth0.android:auth0 | android |
pubspec.yaml + auth0_flutter + 开发者名称/目标平台为 Windows 桌面端 | flutter-windows |
pubspec.yaml + auth0_flutter + flutter.web: false | flutter-native |
pubspec.yaml + auth0_flutter + 启用 Web | flutter-web |
第 2 层 — 根据非 Auth0 工作区依赖识别框架
如果没有匹配到 Auth0 SDK,则根据普通(非 Auth0)依赖识别框架。**遇到第一个匹配项时即停止。**这会确定基础框架;Web 与 API 变体的判断请参见下方“变体消歧”。与第 1 层相同,先检查 @ionic/* 行,再检查其基础框架。
| 信号 | 基础框架 |
|---|---|
package.json 中有 next | nextjs |
package.json 中有 nuxt | nuxt |
package.json 中有 @tanstack/react-start | tanstack-start |
@ionic/* + @angular/core | ionic-angular |
@ionic/* + react | ionic-react |
@ionic/* + vue | ionic-vue |
package.json 中有 @angular/core | angular |
package.json 中有 vue(无 nuxt) | vue |
package.json 中有 expo | expo |
react-native(无 expo) | react-native |
react(无上述元框架) | react(SPA)——见注释 |
package.json 中有 express | express(见下方变体) |
package.json 中有 fastify | fastify(见下方变体) |
requirements.txt/pyproject.toml 中有 flask | flask |
requirements.txt/pyproject.toml 中有 fastapi | fastapi-api(见下方变体) |
pom.xml/build.gradle 中有 spring-boot | springboot-api |
composer.json 中有 laravel/framework | laravel(见下方变体) |
存在 composer.json(无 Laravel) | php(见下方变体) |
存在 go.mod + HTTP 服务端/路由器 | go |
org.jetbrains.kotlin.multiplatform 插件 + commonMain 源集(共享 Android+iOS 模块) | kmp |
Package.swift 或 .xcodeproj | swift |
pubspec.yaml(Flutter)+ 开发者名称/目标平台为 Windows 桌面端 | flutter-windows |
pubspec.yaml(Flutter,已禁用 Web) | flutter-native |
pubspec.yaml(Flutter,已启用 Web) | flutter-web |
*.csproj 引用了 MAUI | maui |
*.csproj(WinForms) | winforms |
*.csproj(WPF) | wpf |
*.csproj ASP.NET(Web 应用或 API) | aspnetcore(见下方变体) |
**
react注释:**纯 React 项目使用 React SDK 构建 SPA 时映射为react;如果应用是与框架无关的原生 JS,则映射为spa-js。如果无法确定,请在加载前询问。
第 3 层 — 根据提示词确定框架
如果没有匹配到工作区信号,则映射请求中提到的框架或语言。命中第一个匹配项后停止。
| 开发者提到…… | 框架 |
|---|---|
Next.js / next | nextjs |
| Nuxt | nuxt |
| TanStack Start (React) | tanstack-start |
| Angular(非 Ionic) | angular |
| Vue(非 Nuxt/Ionic) | vue |
| React SPA(非 Next.js) | react |
| vanilla JS / plain JS / no framework SPA | spa-js |
node-auth0 / auth0 npm 包 | node-auth0 |
@auth0/auth0-api-js / auth0-api-js / 底层资源服务 SDK | auth0-api-js |
@auth0/auth0-server-js / auth0-server-js / 服务端 Auth0 会话 SDK | auth0-server-js |
@auth0/auth0-auth-js / auth0-auth-js / AuthClient / 底层 OAuth OIDC | auth0-auth-js |
| Express(Web 应用 / 服务端渲染) | express |
| Express API / 保护 API 路由 | express-jwt |
| Fastify(Web)/ Fastify API | fastify / fastify-api |
| Flask | flask |
| FastAPI(Web 应用)/ FastAPI API | server-python / fastapi-api |
auth0-server-python / 框架无关的 Python 服务端 SDK / 没有专用参考资料的 Python OIDC Web 服务(Django、Starlette、Sanic、Quart、aiohttp) | server-python |
auth0-api-python / Python API JWT 验证器(资源服务 / verify_access_token) | api-python |
| Spring Boot | springboot-api |
| Java MVC / servlet | java-mvc |
| ASP.NET Core Web 应用 / API | aspnetcore-auth / aspnetcore-api |
| MAUI / WinForms / WPF | maui / winforms / wpf |
| PHP Web 应用 / PHP API | php / php-api |
| Laravel Web 应用 / Laravel API | laravel / laravel-api |
| Go / Golang API | go |
Kotlin Multiplatform / KMP / Android+iOS 共享认证代码 / com.auth0.kmp | kmp |
| Swift / iOS | swift |
| Android / Kotlin | android |
| Flutter(原生 / Web / Windows) | flutter-native / flutter-web / flutter-windows |
| React Native / Expo | react-native / expo |
| Ionic(Angular/React/Vue) | ionic-angular / ionic-react / ionic-vue |
变体消歧(Web 应用与 API)
部分框架有独立的 Web 应用和 API 参考资料。如果第 1 层未确定变体,请优先根据意图选择:
| 基础项 | Web 应用变体 | API 变体 | 在以下情况下选择 API…… |
|---|---|---|---|
| express | express | express-jwt | 保护 API 路由 / 验证 JWT,且没有服务端渲染的 UI |
| fastify | fastify | fastify-api | 仅用于资源服务 / JWT 验证 |
| fastapi | server-python | fastapi-api | 仅用于资源服务 / JWT 验证;带有登录/注销 UI 的 Web 应用使用 server-python |
| php | php | php-api | 构建/保护 PHP API,且没有 Web UI |
| laravel | laravel | laravel-api | 仅 API(token guard),没有 Blade UI |
| aspnetcore | aspnetcore-auth | aspnetcore-api | Web API / JWT bearer,且没有 cookie 登录 UI |
如果意图仍不明确(同时有 UI 和受保护的端点,或情况不清楚),请说明你检测到的内容,并询问开发者这是 Web 应用还是 API,然后再加载。
如果没有匹配项
询问开发者使用的框架/语言。不要猜测。
冲突
如果第 2 层(工作区)和第 3 层(提示词)存在实质冲突(例如,提示词说“Next.js”,但 package.json 中没有 next),请说明冲突并询问,不要默默自行选择。若两者都存在且一致,工作区信号优先于提示词。
第 3 步:检测工具
阅读项目文件树和请求——这是一个项目上下文决策。
| 项目包含…… | 加载 |
|---|---|
terraform/ 目录或任何 *.tf 文件 | tooling-terraform/index.md |
| 此 Agent 会话中已启用 Auth0 MCP 服务 | tooling-mcp/index.md |
| 请求使用 Auth0 Vercel Marketplace/原生集成,或将 Auth0 连接到 Vercel 项目 | tooling-vercel/index.md |
| 其他任何情况(默认) | tooling-cli/index.md |
第 4 步:加载参考文件
找到下方标题与您在第 1 步中选择的意图相匹配的部分,然后阅读其中列出的参考文件。
integrate
Read: references/framework-{framework}/index.md
Read: references/tooling-{tooling}/index.md
Follow the integration workflow in references/framework-{framework}/index.md.
Use references/tooling-{tooling}/index.md for all Auth0 tenant configuration steps.
feature:mfa
Read: references/feature-mfa/index.md
Read: references/tooling-{tooling}/index.md
feature:passkeys
Read: references/feature-passkeys/index.md
Then Read the detected SDK's passkey leaf from the hub's "Example code snippets" table (e.g. nextjs → nextjs-auth0.md; react-native/expo → ONLY react-native-auth0.md, which covers react-native-web — never auth0-react.md) — it has the exact API and ceremony; don't implement from framework-{framework}/index.md alone.
Read: references/tooling-{tooling}/index.md
If framework detected: Read references/framework-{framework}/index.md
feature:organizations
Read: references/feature-organizations/index.md
Read: references/tooling-{tooling}/index.md
If framework detected: Read references/framework-{framework}/index.md
If multi-tenant architecture / B2B SaaS design question: also Read references/pattern-multi-tenant/index.md
feature:universal-portals
Read: references/feature-universal-portals/index.md
Read: references/tooling-{tooling}/index.md
feature:custom-domains
Read: references/feature-custom-domains/index.md
Read: references/tooling-{tooling}/index.md
feature:acul
Read: references/feature-acul/index.md
Read: references/tooling-{tooling}/index.md
feature:branding
Read: references/feature-branding/index.md
Read: references/tooling-{tooling}/index.md
feature:dpop
Read: references/feature-dpop/index.md
Read: references/tooling-{tooling}/index.md
If a SPA framework is detected (vue/react/angular/spa-js): Read references/framework-{framework}/index.md
DPoP is SPA-only (no SSR: Next.js/Nuxt) — feature-dpop/index.md states the exclusion.
feature:custom-token-exchange
Read: references/feature-custom-token-exchange/index.md
Read: references/tooling-{tooling}/index.md
If framework detected: Read references/framework-{framework}/index.md
guidance
Read: references/pattern-security/index.md
If framework detected: Read references/framework-{framework}/index.md (for SDK-specific guidance — token storage, session handling, route protection)
If token handling / JWT vs opaque / storage: Read references/pattern-token-handling/index.md
If multi-tenant / B2B architecture: Read references/pattern-multi-tenant/index.md + references/feature-organizations/index.md
debug
Read: references/pattern-common-errors/index.md
If framework detected: Read references/framework-{framework}/index.md
debug:rate-limit
Read: references/pattern-rate-limiting/index.md
migrate
Read: references/feature-migration/index.md
Read: references/tooling-{tooling}/index.md
If framework detected: Read references/framework-{framework}/index.md
audit
Read: references/feature-audit/index.md
Read: references/feature-audit-pricing/index.md
Read: references/feature-audit-remediation/index.md
Read: references/tooling-{tooling}/index.md
Apply findings only with per-command confirmation; verify each change by re-fetch.
healthcheck
Read: references/feature-healthcheck/index.md
Read: references/feature-audit/index.md
Read: references/feature-audit-pricing/index.md
Read: references/feature-audit-remediation/index.md
Read: references/tooling-{tooling}/index.md
If a scan can run, do the audit workflow first, then score and recommend a plan. If not, score capability fit and recommend anyway. Never quote Enterprise pricing.
upgrade-sdk
Read: references/framework-{framework}/index.md
Follow its "Major Version Migration" section (e.g. Auth0.swift v3, Auth0.Android v4).
This is an Auth0 SDK version bump — NOT a provider migration. Do not load feature-migration/index.md.
If no framework is detected: ask which Auth0 SDK the developer is upgrading.
tooling
Read: references/tooling-{tooling}/index.md
No framework file — this is a CLI/tooling-only task (create apps/APIs, script
tenant setup, automate config in CI). If the developer then wants to integrate
auth into an app, return to Step 1 with the integrate intent.