> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI2MmNjNzE4NS01NDQ1LTRhNmYtODY1NS00OTE5OTFmMTM4YjQiLCJleHAiOjE3NzgyOTQ1MzgsImlhdCI6MTc3ODI5NDIzOH0.hQkZ31mKHdunLBwT5l9tyJwv7NTJsZlV94NVHdaxQOs
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 单点登录

<Warning title="企业功能">
  此功能仅适用于[企业计划](https://buildwithfern.com/pricing)。如需开始使用，请联系 [support@buildwithfern.com](mailto:support@buildwithfern.com)。
</Warning>

SSO 让您的团队通过您组织的身份提供商使用 SAML 2.0 或 OIDC 访问您的文档。与[RBAC](/learn/docs/authentication/features/rbac)和[API 密钥注入](/learn/docs/authentication/features/api-key-injection)一样，SSO 使用[`fern_token`](/learn/docs/authentication/overview#how-authentication-works) cookie 来识别已认证的用户。SSO 解锁了用于浏览器编辑的[Fern Editor](/learn/docs/writing-content/fern-editor)和[认证预览链接](/learn/docs/preview-publish/preview-changes#preview-links)。

<Note>
  SSO 提供基于登录的访问控制，但不支持角色管理或 API 密钥注入。要进行细粒度访问控制，请使用

  [RBAC](/learn/docs/authentication/features/rbac)

  。
</Note>

## 工作原理

当用户点击**登录**时，Fern 会将他们重定向到您的身份提供商。使用企业凭据验证身份后，身份提供商会重定向回 Fern 并提供 `fern_token`，授予访问您文档的权限。

<Accordion title="架构图">
  ```mermaid
  sequenceDiagram
      autonumber
      participant U as User
      participant F as Fern Docs
      participant I as Identity Provider

      U->>F: Click "Login"
      F->>I: Redirect to SSO login

      Note over I: User authenticates with corporate credentials

      I->>I: Validate user credentials
      I->>F: Redirect back with fern_token
      F->>F: Grant access to organizational features
      F->>U: Show docs site
  ```
</Accordion>

## 设置

Fern 支持任何 SAML 2.0 或 OIDC 提供商（Okta、Google Workspace、Auth0、Azure AD、OneLogin 等）。[联系 Fern](https://buildwithfern.com/contact)或通过 Slack 联系我们。Fern 将与您的安全团队合作连接到您的身份提供商。