Loading...
Loading...
Compare original and translation side by side
newCredential()credentials{{$json.token}}newCredential('Label')'Gmail''OpenRouter''Acme API'newCredential()credentials{{$json.token}}newCredential('Label')'Gmail''OpenRouter''Acme API'httpCustomAuthreferences/CUSTOM_CREDENTIALS.mdhttpCustomAuthreferences/CUSTOM_CREDENTIALS.mdcredentialsreferences/CREDENTIAL_SYSTEM.mdcredentialsreferences/CREDENTIAL_SYSTEM.mdNeed to call an external service?
├── Native credential exists (Slack, Gmail, OpenAI, Postgres, ...)?
│ └── Use the native node + its credential type. Done.
│
├── Service is "standard-shaped" (REST + Bearer/Basic/OAuth)?
│ ├── Configure HTTP Request with one of the built-in auth types:
│ │ - Generic OAuth2
│ │ - Header Auth
| | - Bearer Auth (same as header auth but with only field being for actual token)
│ │ - Basic Auth
│ │ - Custom Auth
│ └── See references/HTTP_REQUEST_WITH_AUTH.md
│
└── Service needs multiple static headers, or headers plus query params?
└── Use the httpCustomAuth credential type.
See references/CUSTOM_CREDENTIALS.md需要调用外部服务?
├── 存在原生凭证(Slack、Gmail、OpenAI、Postgres等)?
│ └── 使用原生节点及其凭证类型。完成。
│
├── 服务为“标准类型”(REST + Bearer/基础认证/OAuth)?
│ ├── 使用以下内置认证类型之一配置HTTP Request节点:
│ │ - 通用OAuth2
│ │ - 头部认证
| | - Bearer认证(与头部认证类似,但仅需填写令牌字段)
│ │ - 基础认证
│ │ - 自定义认证
│ └── 参考references/HTTP_REQUEST_WITH_AUTH.md
│
└── 服务需要多个静态头部,或头部加查询参数?
└── 使用httpCustomAuth凭证类型。
参考references/CUSTOM_CREDENTIALS.md"Set up a workflow to call Acme API with bearer"sk-abc123def456
{{$json.token}}Bearer AuthHeader Authn8n-extending-mcp“设置一个工作流,使用Bearer令牌调用Acme API”sk-abc123def456
{{$json.token}}Bearer AuthHeader Authn8n-extending-mcpreferences/FINDING_API_DOCS.mdreferences/HTTP_REQUEST_WITH_AUTH.mdreferences/CUSTOM_CREDENTIALS.mdreferences/FINDING_API_DOCS.mdreferences/HTTP_REQUEST_WITH_AUTH.mdreferences/CUSTOM_CREDENTIALS.md| File | Read when |
|---|---|
| You need to understand how credentials are stored, referenced, scoped, or rotated |
| Multi-header / header-plus-query auth in one credential, or per-request signing patterns (HMAC, JWT, webhook validation) |
| Configuring HTTP Request with auth: Bearer, Basic, OAuth, Header Auth |
| The user mentioned a service you don't have node-level knowledge of |
| 文件 | 阅读场景 |
|---|---|
| 需要了解凭证的存储、引用、作用域或轮换机制时 |
| 需要在单个凭证中配置多头部/头部加查询参数认证,或需处理请求签名模式(HMAC、JWT、Webhook验证)时 |
| 为HTTP Request节点配置认证:Bearer、基础认证、OAuth、头部认证 |
| 用户提及了你不了解的服务时 |
| Anti-pattern | What goes wrong | Fix |
|---|---|---|
Pasting | Token in plain text in the workflow JSON, leaks on export, copy, screenshot | Use a credential: |
| Storing token in a Set node and referencing via expression | Same problem, value lives in workflow JSON | Same fix: credential, not a Set node |
| Using HTTP Request when a native node exists | Loses auto-refresh on OAuth, loses native error handling, more code | Use the native node |
Hardcoding credentials in SDK code ( | Same leak surface | Use |
| Asking the user to create a credential without naming the credential type | User picks the wrong type, auth fails confusingly | Always specify: "create a credential of type |
| 反模式 | 问题所在 | 修复方案 |
|---|---|---|
将 | 令牌以明文形式存在于工作流JSON中,导出、复制、截图时会泄露 | 使用凭证:Bearer令牌用 |
| 将令牌存储在Set节点中并通过表达式引用 | 同样的问题,值存储在工作流JSON中 | 相同修复方案:使用凭证,而非Set节点 |
| 存在原生节点时仍使用HTTP Request节点 | 失去OAuth自动刷新功能、原生错误处理,需要编写更多代码 | 使用原生节点 |
在SDK代码中硬编码凭证( | 同样存在泄露风险 | 在SDK代码中使用 |
| 让用户创建凭证但不指定凭证类型 | 用户选错类型,导致认证失败且难以排查 | 始终明确指定:“创建类型为 |