Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 1.24 KB

cred-class-field-authenticate-type-assertion.md

File metadata and controls

52 lines (41 loc) · 1.24 KB

cred-class-field-authenticate-type-assertion

In a credential class, the field authenticate must be typed IAuthenticateGeneric

📋 This rule is part of the plugin:n8n-nodes-base/credentials config.

🔧 Run ESLint with --fix option to autofix the issue flagged by this rule.

Examples

❌ Example of incorrect code:

class TestApi implements ICredentialType {
    name = 'myTestApi';
    displayName = 'My Test API';
    documentationUrl = 'myTest';
    authenticate = {
        type: 'generic',
        properties: {
            headers: {
                Authorization: '=Token {{$credentials.token}}',
            },
        },
    } as IAuthenticateGeneric;
}

✅ Example of correct code:

class TestApi implements ICredentialType {
	name = "myTestApi";
	displayName = "My Test API";
	documentationUrl = "myTest";
	authenticate: IAuthenticateGeneric = {
		type: "generic",
		properties: {
			headers: {
				Authorization: "=Token {{$credentials.token}}",
			},
		},
	};
}

Links