# 认证

Afarensis GPT提供不同的身份验证架构，以适应各种用例。以下将详细介绍如何为您的操作指定身份验证架构。

### 无身份验证

我们支持应用程序无需身份验证的流程，用户可以直接向您的 API 发送请求，而无需 API 密钥或使用 OAuth 登录。请考虑对初始用户交互不使用身份验证，因为如果用户被迫登录应用程序，则可能会遇到用户丢失的情况。可以创建“注销”体验，然后通过启用单独的操作将用户移动到“已登录”体验。

### API 密钥身份验证

如果您的 API 执行的后果性操作比无身份验证流稍多，但不需要单个用户登录，则此方法非常有用。添加 API 密钥身份验证可以保护您的 API，并为您提供更精细的访问控制，以及对请求来源的可见性。我们会对其进行加密，以确保您的 API 密钥安全。

### OAuth

操作允许每个用户登录 OAuth。这是提供个性化体验并向用户提供最强大的操作的最佳方式。OAuth流程的简单示例如下：

1. 在 GPT 编辑器 UI 中选择“身份验证”，然后选择“OAuth”。
2. 系统将提示您输入 OAuth 客户端 ID、客户端密码、授权 URL、令牌 URL 和范围。
3. 为了让某人在 OAuth 中使用操作，他们需要发送一条调用该操作的消息，然后用户将在 ChatGPT UI 中看到“登录 \[域]”按钮。
4. 在用户登录过程中，ChatGPT 使用指定的向您发出请求，我们希望取回一个访问令牌和一个刷新令牌（可选）。
5. 每次用户向操作发出请求时，用户的令牌都会在 Authorization 标头中传递。


---

# Agent Instructions: 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:

```
GET https://doc.afarensis.com/xing-dong/ren-zheng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
