> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

## 自托管文档的 API 密钥注入

自托管部署通过环境变量支持 [API 密钥注入](/learn/zh/docs/authentication/features/api-key-injection)。启用 `FERN_API_KEY_INJECTION_ENABLED` 在 API Explorer 中显示 **登录** 按钮，而无需对整个站点要求登录。使用 `FERN_AUTH_ALLOWLIST` 和 `FERN_AUTH_DENYLIST` 控制页面级别的访问。

阅读文档

## 多个 API 密钥和每环境密钥

API 密钥注入支持 [多个 API 密钥](/learn/zh/docs/authentication/setup/jwt#build-the-fern-claim) 和 [每环境凭据](/learn/zh/docs/authentication/setup/jwt#build-the-fern-claim)。在 `bearer_token` 中提供多个密钥作为 JSON 编码的数组，并使用 `env_state` 通过子字符串匹配为每个环境设置不同的凭据。

阅读文档