> 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.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJiNWU3NWE2Ny1iZTllLTQxMmQtYjFlYy1hMmZmNzBkZTQxNDgiLCJleHAiOjE3NzgyODE0NDksImlhdCI6MTc3ODI4MTE0OX0.RhSxOYp3sSg49zl509nvexUq_9UHbYEVCZX_XcqJNSw
>
> 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.

# 安全性

> 了解 Fern 的文档平台如何通过客户端身份验证、API 密钥注入和自托管选项来保护您的 API 文档。

Fern 的文档平台以安全性为核心原则构建，使用客户端架构进行身份验证和凭据处理。用户凭据和敏感数据仅存储在浏览器 cookie 中，永远不会传输到 Fern 的服务器。

<Note title="安全问题">
  如需安全审查、附加文档或特定合规要求，请联系 [support@buildwithfern.com](mailto:support@buildwithfern.com)。
</Note>

## 身份验证和 API 密钥注入

Fern 支持[多种身份验证方法](/learn/docs/authentication/overview)来保护您的文档。所有方法都使用完全存储在浏览器中的客户端 `fern_token` cookie：

* [基于角色的访问控制 (RBAC)](/learn/docs/authentication/features/rbac) 根据用户角色控制哪些用户可以访问特定文档内容（存储用户角色）
* [API 密钥注入](/learn/docs/authentication/features/api-key-injection) 自动使用用户特定的 API 密钥填充代码示例，提供个性化体验（通过 JWT 或 OAuth 存储身份验证令牌）
* [单点登录 (SSO)](/learn/docs/authentication/setup/sso) 与您现有的身份提供商集成，实现无缝身份验证（存储身份提供商令牌）

这些 cookie 完全在客户端管理，当用户注销或会话过期时会自动清除。这种方法确保敏感凭据始终在您的控制之下，永远不会暴露给 Fern 的基础设施。

## 自托管部署

对于在隔离环境中运行或需要完全控制文档服务器的组织，Fern 提供[自托管部署](/learn/docs/enterprise/self-hosted)。