---
title: 连接 OpenID Connect 提供商
description: 连接 Keycloak、Microsoft Entra ID、Auth0、Ping Identity 或其他 OpenID Connect 提供商，设置群组声明，并把群组映射到 Pyn 角色。
sidebar:
  order: 2
area: integrations
feature: sso
appPath: /settings/integrations/available
lastVerified: 2026-11-09
version: "2026-11-09"
audience: admin
related:
  - integrations/sso
  - integrations/sso/connect-okta
  - settings/users
intercom:
  - id: "16838066"
    title: Enabling Single Sign On (Pyn 2)
    url: https://intercom.help/pyn/en/articles/16838066-enabling-single-sign-on-pyn-2
    note: replaces
translation:
  source: integrations/sso/connect-an-oidc-provider.mdx
  sourceSha: 6c4fc9c14619f4daa3b2e06d83cb418cd8d3b119
---

你的身份提供商支持 OpenID Connect，你希望由它让员工登录 Pyn 并决定他们的角色。Single Sign-On 集成接收提供商、它的签发者和一个使用授权码流程的客户端，检查提供商的 OpenID 配置，并显示你需要的重定向 URI 和登录链接。

## 开始之前

- 你是 Pyn 中的管理员或所有者，并且你的工作区启用了 Single Sign-On 集成。
- 有人可以在你的提供商中创建一个机密客户端："The client needs the standard authorization code flow and a client secret." Pyn 请求 `openid`、`profile` 和 `email` 范围；要进行角色映射，ID 令牌需要一个 `groups` 声明（Entra 发出的是 `roles`），任何用于解锁它的范围填在 **Additional Scopes** 中。
- 你有签发者、客户端 ID 和客户端密钥。对于 Keycloak，你需要 **Keycloak Server URL** 和 **Realm**；Pyn 由它们组合出签发者。

![Connect single sign-on: choose the Provider, then enter the issuer, client ID, client secret and groups claim.](https://support.pyn.ai/media/integrations/sso/integrations-sso-connect.png)

## 步骤

1. 在 Pyn 中，打开左侧导航中的 **Settings**，然后打开 **Integrations** 下的 **Available**。

2. 选择 **Single Sign-On** 磁贴。**Connect single sign-on** 对话框打开。

3. 选择 **Provider**：**Keycloak**、**Okta**、**Microsoft Entra ID**、**Auth0**、**Ping Identity**，或为其他任何提供商选择 **Single Sign-On**。

4. 对于 Keycloak，输入 **Keycloak Server URL** 和 **Realm**；对于其他提供商，输入 **Issuer URL**。

5. 输入 **Client ID** 和 **Client Secret**。如果你的提供商使用的名称不是 `groups`，设置 **Groups Claim**；如果它需要的范围多于 `openid profile email`，设置 **Additional Scopes**。

6. 复制对话框中显示的 **Redirect URI**："Add this as a valid redirect URI on the client in your provider, then come back and connect."

7. 选择 **Connect**。对话框显示 "Checking those details with your provider..."，然后出现通知："Single sign-on is configured. Use the sign-in link on the integration to let your people sign in with it."

8. 在面板上的 **Group mappings** 下，为 **Owner groups**、**Admin groups**、**Power user groups** 和 **User groups** 输入以逗号分隔的群组名称，从所有者开始。

> **Caution:** 一旦设置了任何群组映射，提供商就会在每次登录时决定角色，不匹配任何群组的人会成为 User。先映射你的所有者。

## 你应该看到什么

磁贴在 **Installed** 下显示 **Active**，面板显示 **Redirect URI** 和 **Sign-in link**："Share this with your people to sign in through your provider. Opening it signs you in." 如果对话框拒绝，查看它给出的原因："That address answered, but not with an OpenID configuration." 表示签发者不是提供商发布其配置所用的基础 URL；"Could not reach that issuer." 表示它无法从互联网访问；"The issuer needs to be a full URL, starting with https://." 是格式问题；"An unexpected error occurred. Please check the details and try again. If the error persists, contact support." 表示请求没有送达，请再试一次。**...** 菜单中的 **Reconnect** 重新打开对话框以更改其中任何内容。

## 相关

- [单点登录](https://support.pyn.ai/zh-cn/integrations/sso/)，了解角色映射和员工看到的内容。
- [连接 Okta](https://support.pyn.ai/zh-cn/integrations/sso/connect-okta/)，了解专用的 Okta 集成。
- [用户](https://support.pyn.ai/zh-cn/settings/users/)，了解群组列表所指的角色。
