> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/text-and-number/two-factor-authentication.md).

# 2FA代码

2FA 代码是用于自动生成基于时间变化的 6 位数字双重验证代码的操作（类似于手机上的 Google Authenticator 或 Authy），该代码由提供的原始安全密钥生成。

此操作在 MMO 场景中至关重要，帮助自动绕过登录 Facebook、Google、X (Twitter)、Discord、Coinlist 等账户时的安全验证步骤，而无需打开手机手动输入。

#### 配置参数：

* Secret key: 原始安全密钥（由字母和数字组成的长字符串，通常在您在网站上启用双重安全功能时提供）。
* Output variable: 存储生成的 6 位数字验证码的变量名称。

#### 实际示例：自动填写 Facebook 登录时的 2FA 代码

假设您在 Excel 中有一个 Facebook 账户的数据，其中该账户的双重安全密钥（Secret key）列为：`JBSWY3DPEHPK3PXP`。

当浏览器导航到 Facebook 登录页面后，在输入用户名/密码后，Facebook 将要求输入 6 位数字验证码以进入账户。您可以按如下方式配置自动处理脚本：

* 配置方式：
  * 调用 2FA 代码操作。
  * Secret key: 输入字符串 `JBSWY3DPEHPK3PXP`（或从读取的 Excel 文件中传递包含该字符串的变量）。
  * Output variable: 将变量命名为 `$twoFACode`。
* 结果：系统将根据时间加密算法立即计算出当前的 6 位数字代码（例如：`482915`），并将其存储在变量 `$twoFACode` 中。在此操作之后，您继续调用 Key press 命令，将变量 `$twoFACode` 传递到 Facebook 的验证码输入框中，即可成功登录。


---

# 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://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/text-and-number/two-factor-authentication.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.
