创建和编辑凭据(Create and edit credentials)#
凭据是安全存储的身份验证信息,用于将 n8n 工作流连接到外部服务,例如 API 或数据库。
🌐 Credentials are securely stored authentication information used to connect n8n workflows to external services such as APIs, or databases.
创建凭据(Create a credential)#
- 在侧边菜单的左上角选择
创建按钮。选择凭证。 - 如果你的 n8n 实例支持 项目,你还需要选择是在你的个人空间中创建凭证,还是在你有访问权限的特定项目中创建。如果你使用的是社区版,则需要在你的个人空间中创建凭证。
- 选择要连接的应用或服务。
或:
🌐 Or:
- 在 Overview 页面或某个特定项目的右上角使用
创建 按钮。选择 凭证。 - 如果你是在概览页面进行操作,你将在个人空间内创建凭证。如果你是在某个项目内部操作,你将在该特定项目内创建凭证。
- 选择要连接的应用或服务。
你还可以在凭证投放中创建新凭证。在工作流编辑器中编辑节点时,可能会出现此问题。
🌐 You can also create new credential in the credential drop down when editing a node on the workflow editor.
进入凭证模态后,输入你的服务所需的详细信息。有关指导,请参阅你的服务在凭证库中的页面。
🌐 Once in the credential modal, enter the details required by your service. Refer to your service's page in the credentials library for guidance.
保存凭据后,n8n 会对其进行测试以确认其有效。
🌐 When you save a credential, n8n tests it to confirm it works.
凭据命名
n8n 默认将新凭据命名为“节点名称 账户”。你可以通过点击名称来重命名凭据,方式类似于重命名节点。最好给凭据命名时包含应用或服务的名称、类型以及凭据的用途。命名规范可以让你更容易跟踪和识别凭据。
凭据中的表达式(Expressions in credentials)#
您可以使用表达式在工作流运行时动态设置凭据:
🌐 You can use expressions to set credentials dynamically as your workflow runs:
- 在你的工作流程中,找到包含凭证的数据路径。这取决于你数据中的具体参数名称。当你到达需要它的节点时,确保包含凭证的数据在工作流程中可用。
- 创建凭证时,将鼠标悬停在要使用表达式的字段上。
- 开启表情。
- 输入你的表达式。
示例工作流程(Example workflow)#
Workflow preview placeholder.
使用示例(Using the example)#
To load the template into your n8n instance:
- Download the workflow JSON file.
- Open a new workflow in your n8n instance.
- Copy in the JSON, or select Workflow menu
> Import from file....
The example workflows use Sticky Notes to guide you:
- Yellow: notes and information.
- Green: instructions to run the workflow.
- Orange: you need to change something to make the workflow work.
- Blue: draws attention to a key feature of the example.