N8N中文教程
使用 n8n/Using_the_app/Manage_users_and_access/OIDC

配置 OIDC#

功能可用性

  • 仅在 Enterprise(企业版)计划中可用。
  • 您必须是实例所有者或管理员,才能启用和配置 OIDC。

设置并启用 OIDC#

  1. 在 n8n 中,进入 设置(Settings) > SSO
  2. 选择认证协议(Select Authentication Protocol) 下拉菜单中,选择 OIDC
  3. 复制显示的 重定向 URL(redirect URL)(例如:https://yourworkspace.app.n8n.cloud/rest/sso/oidc/callback)。 负载均衡器或代理的额外配置 如果 n8n 运行在负载均衡器之后,请确保设置了 N8N_EDITOR_BASE_URL 环境变量。
  4. 使用您的身份提供商(IdP)配置 OIDC。您需要:
    • 在您的 IdP 中创建一个新的 OIDC 客户端/应用(OIDC client/application)。
    • 配置上一步中的重定向 URL。
    • 记录下 IdP 提供的 客户端 ID(Client ID)客户端密钥(Client Secret)
  5. 在您的 IdP 中找到 发现端点(Discovery Endpoint)(也称为 well-known 配置端点)。其通常具有以下格式:
1

| ``` https://your-idp-domain/.well-known/openid-configuration


---|---
  6. 在 n8n 中完成 OIDC 配置:
     * **发现端点(Discovery Endpoint)**:输入来自 IdP 的发现端点 URL。
     * **客户端 ID(Client ID)**:输入在 IdP 注册应用时获得的客户端 ID。
     * **客户端密钥(Client Secret)**:输入在 IdP 注册应用时获得的客户端密钥。
  7. 点击 **保存设置(Save settings)**。
  8. 将 OIDC 状态设置为 **已激活(Activated)**。

## 供应商特定的 OIDC 配置#
### Auth0#
  1. **在 Auth0 中创建应用**:
     * 登录到你的 Auth0 控制台(Dashboard)。
     * 进入 **Applications** > **Applications**。
     * 点击 **Create Application**。
     * 输入名称(例如,“n8n SSO”),并选择 **Regular Web Applications**。
     * 点击 **Create**。
  2. **配置应用**:
     * 进入新应用的 **Settings** 选项卡。
     * **Allowed Callback URLs**:添加你在 n8n 的 **Settings** > **SSO** > **OIDC** 中设置的重定向 URL。
     * **Allowed Web Origins**:添加你的 n8n 基础 URL(例如,`https://yourworkspace.app.n8n.cloud`)。
     * 点击 **Save Changes**。
  3. **获取凭据**:
     * **Client ID**:位于 **Settings** 选项卡中。
     * **Client Secret**:位于 **Settings** 选项卡中。
     * **Discovery Endpoint**:`https://{your-auth0-domain}.auth0.com/.well-known/openid-configuration`。
  4. **在 n8n 中完成 OIDC 配置**:
     * **Discovery Endpoint**:输入来自 Auth0 的发现端点 URL。
     * **Client ID**:输入你在 Auth0 设置中找到的客户端 ID。
     * **Client Secret**:输入你在 Auth0 设置中找到的客户端密钥。
  5. 点击 **Save settings**。
  6. 将 OIDC 设置为 **Activated(已激活)**。

## 发现端点参考#
  * **Google 发现端点示例**:

1

| ```
https://accounts.google.com/.well-known/openid-configuration

---|---

  • Microsoft Azure AD 发现端点示例
1

| ``` https://login.microsoftonline.com/{tenant-id}/v2.0/.well-known/openid-configuration


---|---
  * **Auth0 发现端点示例**:

1

| ```
https://{your-domain}.auth0.com/.well-known/openid-configuration

---|---

  • Okta 发现端点示例
1

| ``` https://{your-domain}.okta.com/.well-known/openid-configuration


---|---