자격 증명 파일
자격 증명 파일은 node의 인증 방법을 정의합니다. 자격 증명 파일에서 모든 n8n UI 요소를 사용할 수 있습니다. 자격 증명 파일은 다음 기본 구조를 따릅니다: 문자열. 문자열. 문자열. 오브젝트. n8n이 자격 증명을 테스트하는 데 사용할 수 있는 URL과 인증 유형을 포함하는 request 오브젝트를 제공합니다.
자격 증명 파일은 node의 인증 방법을 정의합니다. 이 파일의 설정은 n8n이 자격 증명 모달에서 표시하는 내용에 영향을 미치며, 연결하는 서비스의 인증 요구사항을 반영해야 합니다.
자격 증명 파일에서 모든 n8n UI 요소를 사용할 수 있습니다. n8n은 자격 증명을 사용하여 저장된 데이터를 암호화 키로 암호화합니다.
자격 증명 파일 구조#
자격 증명 파일은 다음 기본 구조를 따릅니다:
- 임포트 문
- 자격 증명을 위한 클래스 생성
- 클래스 내에서 node의 인증을 제어하는 속성 정의
개요 구조#
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class ExampleNode implements ICredentialType {
name = 'exampleNodeApi';
displayName = 'Example Node API';
documentationUrl = '';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
// body, header, qs 또는 auth가 될 수 있습니다
qs: {
// 위의 `apiKey` 값을 사용합니다
'api_key': '={{$credentials.apiKey}}'
}
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials?.domain}}',
url: '/bearer',
},
};
}
파라미터#
name#
문자열. 오브젝트의 내부 이름. node의 다른 위치에서 참조하는 데 사용됩니다.
displayName#
문자열. n8n이 GUI에서 사용하는 이름.
documentationUrl#
문자열. 자격 증명 문서의 URL.
properties#
각 오브젝트에는 다음이 포함됩니다:
displayName: n8n이 GUI에서 사용하는 이름.name: 오브젝트의 내부 이름. node의 다른 위치에서 참조하는 데 사용됩니다.type:string과 같이 예상되는 데이터 유형.default: n8n이 자격 증명을 테스트하는 데 사용해야 하는 URL.
authenticate#
authenticate: 오브젝트. API 요청의 일부로 인증 데이터를 주입하는 방법을 n8n에게 알려주는 오브젝트를 포함합니다.
type#
문자열. 헤더, 바디 또는 쿼리 문자열에서 데이터를 보내는 인증 방법을 사용하는 경우 이를 'generic'으로 설정합니다.
properties#
오브젝트. 인증 방법을 정의합니다. 옵션:
body: 오브젝트. 요청 바디에서 인증 데이터를 전송합니다. 중첩된 오브젝트를 포함할 수 있습니다.
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
body: {
username: '={{$credentials.username}}',
password: '={{$credentials.password}}',
},
},
};
header: 오브젝트. 요청 헤더에서 인증 데이터를 전송합니다.
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
header: {
Authorization: '=Bearer {{$credentials.authToken}}',
},
},
};
qs: 오브젝트. "쿼리 문자열"의 약자. 요청 쿼리 문자열에서 인증 데이터를 전송합니다.
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
qs: {
token: '={{$credentials.token}}',
},
},
};
auth: 오브젝트. Basic Auth에 사용됩니다. 키 이름으로username과password가 필요합니다.
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
auth: {
username: '={{$credentials.username}}',
password: '={{$credentials.password}}',
},
},
};
test#
n8n이 자격 증명을 테스트하는 데 사용할 수 있는 URL과 인증 유형을 포함하는 request 오브젝트를 제공합니다.
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials?.domain}}',
url: '/bearer',
},
};
