为用户和权限设置 Auth0 提供程序
🌐 Auth0 provider setup for Users & Permissions
本页解释了如何为用户与权限功能设置 Auth0 提供程序。
🌐 The present page explains how to setup the Auth0 provider for the Users & Permissions feature.
Auth0 配置
🌐 Auth0 configuration
Note
AWS Cognito 接受 localhost URL。
不需要使用 ngrok。
- 访问你的 Auth0 租户仪表板
- 在 API 部分,创建一个新的 API
- 在应用中,创建一个
machine-to-machine应用并选择你刚刚创建的 API - 在此应用的设置中设置以下值:
- 允许的回调 URL:
http://localhost:1337/api/connect/auth0/callback - 允许的退出登录 URL:
http://localhost:3000 - 允许的网页来源:
http://localhost:3000
- 允许的回调 URL:
- 在设置底部,显示“高级设置”并进入“授权类型”。确保勾选/启用这些授权:
- 隐含的
- 授权码
- 刷新令牌
- 客户端凭据
Strapi 配置
🌐 Strapi configuration
- 访问用户与权限提供程序设置页面,网址为 http://localhost:1337/admin/settings/users-permissions/providers
- 点击 Auth0 提供商
- 填写信息:
- 启用:
ON - 客户ID:
<Your Auth0 Client ID> - 客户端密钥:
<Your Auth0 Client Secret> - 子域名:
<Your Auth0 tenant url>,例如,它是在以下网址中加粗的部分:https://my-tenant.eu.auth0.com/ - 重定向到你的前端应用的 URL:
http://localhost:3000/connect/auth0
- 启用:
你的配置已完成。启动后端和 react login example application,转到http://localhost:3000并尝试连接你配置的提供程序。