> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/fa-bu/site-audience/authenticated-access.md).

# 已验证访问

经过身份验证的访问可让您发布内容，同时要求任何想要查看内容的访客进行身份验证。启用后，GitBook 会让您的身份验证提供商来处理谁可以访问内容。

<figure><img src="/files/0710cefed65944f46d32306d933dc7363f8ae76d" alt="A screenshot showing a login screen for docs behind authenticated access"><figcaption><p>为您已发布的文档添加登录。</p></figcaption></figure>

### 用例

经过身份验证的访问的常见用例包括：

* 发布敏感的产品文档，这些文档应仅供付费客户、销售潜在客户或合作伙伴访问。
* 发布仅应供贵公司员工访问的内部知识库内容。

### 运作方式

设置经过身份验证的访问时，您可以选择两种方法：

1. 安装我们的某个身份验证集成——目前支持 Okta、Azure 和 Auth0。我们 **强烈推荐** 如果您正在使用我们支持的身份验证提供商，则使用此选项。
2. 创建并托管您自己的服务器来处理身份验证。可以使用许多不同的技术，但由您来编写代码并维护所选方案。

### 内置登录和登出 URL

GitBook 会为您在已发布站点上的登录和登出提供内置 URL：

* `<publishedSiteURL>/~gitbook/auth/login`
* `<publishedSiteURL>/~gitbook/auth/logout`

可在任何需要登录链接的位置使用登录 URL，例如您网站页眉中的链接。

当访客打开登录 URL 时，GitBook 会将其重定向到为该站点配置的身份验证后端。这适用于集成后端和自定义后端。

GitBook 还会添加一个 `location` 与访客最初访问的页面相匹配的查询参数。您的后端可以使用该值在登录后将其送回同一页面。

使用登出 URL 可让访客退出其 GitBook 会话。

前往 [启用经过身份验证的访问](/docs/documentation/zh/fa-bu/site-audience/authenticated-access/enabling-authenticated-access.md) 开始为您的站点设置受保护访问。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/documentation/zh/fa-bu/site-audience/authenticated-access.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
