N8N-4126 credentials injection and testing on specific nodes (#3816)

* Add credential injection and testing to Lemlist, Uproc, Supabase, Segment, Phantombuster, Mailgun and Dropcontact
This commit is contained in:
agobrech
2022-08-24 10:26:48 +02:00
committed by GitHub
parent 5285fc1de6
commit 76f9ad8bae
15 changed files with 167 additions and 114 deletions

View File

@@ -17,16 +17,9 @@ export async function lemlistApiRequest(
qs: IDataObject = {},
option: IDataObject = {},
) {
const { apiKey } = (await this.getCredentials('lemlistApi')) as {
apiKey: string;
};
const encodedApiKey = Buffer.from(':' + apiKey).toString('base64');
const options: OptionsWithUri = {
headers: {
'user-agent': 'n8n',
Authorization: `Basic ${encodedApiKey}`,
},
method,
uri: `https://api.lemlist.com/api${endpoint}`,
@@ -48,7 +41,7 @@ export async function lemlistApiRequest(
}
try {
return await this.helpers.request!(options);
return await this.helpers.requestWithAuthentication.call(this,'lemlistApi',options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
}