SuperAPI AI 工具集

n8n-syntax-credentials

安全与审计

查看项目

更新于 10-15 22:18

技能介绍

用途:面向 n8n 节点开发者,指导创建自定义凭据(credentials)、实现认证、配置 OAuth2 以及测试凭据连接,避免常见的认证配置错误。

主要能力:说明 ICredentialType 接口字段(name、displayName、documentationUrl、properties、authenticate、test、extends、icon 等);列出凭据属性类型(string、number、boolean、options、hidden);讲解 authenticate 的四种注入方式——查询字符串 qs、请求头 headers、请求体 body、Basic auth auth,且均需 type: 'generic';给出 API Key、查询串、Basic Auth、Body 注入、OAuth2、凭据测试、package.json 注册、extends 继承、节点 execute() 中使用凭据等模式。

必要用法:敏感字段须设 typeOptions: { password: true };凭据须在 package.json 的 n8n.credentials 数组中注册并指向 dist/ 下编译后的 .js 文件;authenticate 表达式须带 = 前缀,如 '=Bearer {{$credentials.apiKey}}';节点中通过 this.getCredentials('credentialTypeName') 读取,使用 authenticate 时配合 httpRequestWithAuthentication。

限制:authenticate 与在 execute() 中手动注入不可同时用于同一凭据;不得明文存储凭据或在节点代码中硬编码;OAuth2 需 extends 'oAuth2Api'。具体版本与平台细节暂未提供。