Skip to main content

Auth0 提供商设置用户和权限

¥Auth0 provider setup for Users & Permissions

本页面说明如何为 用户和权限功能 设置 Auth0 提供程序。

¥The present page explains how to setup the Auth0 provider for the Users & Permissions feature.

Prerequisites

你已阅读 用户和权限提供商文档

¥You have read the Users & Permissions providers documentation.

Auth0 配置

¥Auth0 configuration

注意

AWS Cognito 接受 localhost URL。
不需要使用 ngrok

¥AWS Cognito accepts the localhost urls.
The use of ngrok is not needed.

  1. 访问你的 Auth0 租户仪表板

    ¥Visit your Auth0 tenant dashboard

  2. 在 API 部分,创建一个新的 API

    ¥In API section, create a new API

  3. 在应用中,创建 machine-to-machine 应用并选择刚刚创建的 API

    ¥In application, create a machine-to-machine application and select the API that you have just created

  4. 在此应用的设置中设置以下值:

    ¥In settings of this app set these values:

    • 允许的回调 URL:http://localhost:1337/api/connect/auth0/callback

      ¥Allowed Callback URLs: http://localhost:1337/api/connect/auth0/callback

    • 允许的注销 URL:http://localhost:3000

      ¥Allowed Logout URLs: http://localhost:3000

    • 允许的 Web 来源:http://localhost:3000

      ¥Allowed Web Origins: http://localhost:3000

  5. 在设置底部,显示 "高级设置" 并转到 "补助金类型"。确保检查/启用这些授权:

    ¥At the bottom of settings, show "Advanced Settings" and go to the "Grant Types". Ensure that these grants are checked/enabled:

    • 隐含的

      ¥Implicit

    • 授权码

      ¥Authorization Code

    • 刷新令牌

      ¥Refresh Token

    • 客户凭证

      ¥Client Credentials

表带配置

¥Strapi configuration

  1. 访问用户和权限提供商设置页面位于 [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) 

    ¥Visit the User & Permissions provider settings page at http://localhost:1337/admin/settings/users-permissions/providers 

  2. 单击 Auth0 提供商

    ¥Click on the Auth0 provider

  3. 填写信息:

    ¥Fill the information:

    • 使能够:ON

      ¥Enable: ON

    • 客户编号:<Your Auth0 Client ID>

      ¥Client ID: <Your Auth0 Client ID>

    • 客户秘密:<Your Auth0 Client Secret>

      ¥Client Secret: <Your Auth0 Client Secret>

    • 子域名:<Your Auth0 tenant url>,例如下面 url 中粗体部分:https://my-tenant.eu.auth0.com/

      ¥Subdomain: <Your Auth0 tenant url>, example it is the part in bold in the following url: https://my-tenant.eu.auth0.com/

    • 前端应用的重定向 URL:http://localhost:3000/connect/auth0

      ¥The redirect URL to your front-end app: http://localhost:3000/connect/auth0

你的配置已完成。启动后端和 react login 示例应用 ,转到 http://localhost:3000 并尝试连接到你配置的提供商。

¥Your configuration is done. Launch the backend and the react login example application , go to http://localhost:3000 and try to connect to the provider you configured.