运行时依赖
安装命令
点击复制技能文档
Auth0 CLI — 命令参考 Auth0 CLI(auth0)允许您从终端管理您的租户。使用 brew install auth0/auth0-cli/auth0 安装。有关完整的标志定义和示例,请参阅完整的 CLI 参考。 开始前: 身份验证 auth0 登录 # 交互式设备代码登录 auth0 登录 --scopes "read:client_grants" # 请求额外的范围,如果 403 auth0 登录 --domain <租户>.auth0.com --client-id --client-secret # CI/CD 请参阅身份验证详细信息,用于机器登录、租户管理和退出。 快速决策指南 您要做什么 命令 设置新项目 auth0 apps create --type spa|regular|m2m|native --json 需要客户端 ID 或密钥 auth0 apps show -r --json 注册后端 API auth0 apis create --identifier "https://..." --json 查找用户的 ID auth0 users search --query "email:..." --json 创建/管理角色(RBAC) auth0 roles create / auth0 users roles assign B2B 多租户 auth0 orgs create 自定义登录逻辑 auth0 actions create --trigger post-login --json 品牌登录页面 auth0 ul update --logo ... --accent ... 自定义域名用于登录 auth0 domains create --domain "auth.myapp.com" --json 调试失败的登录 auth0 logs tail --filter "type:f" --json-compact 测试登录流程 auth0 test login 将配置导出为 Terraform auth0 terraform generate --output-dir ./terraform 管理连接、授权、钩子 auth0 api get 脚本/解析输出 添加 --json 或 --json-compact 到任何命令 安全加固 auth0 protection brute-force-protection update --enabled true 将日志路由到外部 auth0 logs streams create datadog|http|splunk 批量导入用户 auth0 users import --connection-name ... --users '...' --json 命令概述 应用 — 管理应用程序 创建或检查 Auth0 应用程序(客户端 ID、密钥、回调 URL、应用类型)。 别名:auth0 clients。 auth0 apps create --name "My SPA" --type spa \ --callbacks "http://localhost:3000" \ --logout-urls "http://localhost:3000" \ --origins "http://localhost:3000" --json auth0 apps list --json-compact auth0 apps show --reveal-secrets --json auth0 apps update --callbacks "http://localhost:3000,https://myapp.com" --json auth0 apps delete --force 应用类型:spa、regular、m2m、native、resource_server 详细信息:应用参考 API — 管理 API 资源 注册后端 API(资源服务器)以使用 Auth0 令牌进行保护。 别名:auth0 resource-servers。 auth0 apis create --name "My API" --identifier "https://api.myapp.com" \ --scopes "read:data,write:data" --token-lifetime 3600 --json auth0 apis list --json-compact auth0 apis scopes list --json 关键区别:apps = 请求令牌的客户端。 apis = 接受令牌的资源。 详细信息:API 参考 用户 — 管理用户 创建、搜索、检查、导入和管理租户中的用户。 auth0 users search --query "email:user@example.com" --json auth0 users search-by-email user@example.com --json-compact auth0 users create --connection-name "Username-Password-Authentication" \ --email "test@example.com" --password "SecureP@ss!" --json auth0 users show --json auth0 users blocks list --json auth0 users blocks unblock auth0 users import --connection-name "Username-Password-Authentication" \ --users '[...]' --upsert --json 详细信息:用户参考 角色 — 管理 RBAC 角色 创建角色、分配权限并将角色分配给用户。 CLI 有专门的命令用于所有角色操作。 auth0 roles create --name "editor" --description "Can edit content" --json auth0 roles permissions add --api-id --permissions "read:data,write:data" --json auth0 users roles assign --roles auth0 users roles show --json-compact 详细信息:角色参考 组织 — B2B 多租户 管理组织以用于 B2B SaaS 场景。 别名:auth0 orgs。 auth0 orgs create --name "acme-corp" --display "Acme Corporation" \ --logo "https://acme.com/logo.png" --accent "#FF6600" --json auth0 orgs members list --json auth0 orgs invitations create --org-id --invitee-email "new@acme.com" \ --inviter-name "Admin" --client-id --json 详细信息:组织参考 操作 — 服务器端身份验证管道 创建和部署服务器端函数在身份验证管道触发点。 替换已弃用的规则。 auth0 actions create --name "Add Claims" --trigger "post-login" \ --code 'exports.onExecutePostLogin = async (event, api) => { ... }' --json auth0 actions deploy 触发器:post-login、credentials-exchange、pre-user-registration、post-user-registration、post-change-password、send-phone-message 重要:您必须在创建或更新后部署更改才能生效。 详细信息:操作参考 日志 — 调试和监控 auth0 logs tail --filter "type:f"