mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
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:
@@ -17,18 +17,14 @@ export async function segmentApiRequest(
|
||||
| IWebhookFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
body: any = {}, // tslint:disable-line:no-any
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('segmentApi');
|
||||
const base64Key = Buffer.from(`${credentials.writekey}:`).toString('base64');
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
Authorization: `Basic ${base64Key}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method,
|
||||
@@ -41,7 +37,7 @@ export async function segmentApiRequest(
|
||||
delete options.body;
|
||||
}
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
return await this.helpers.requestWithAuthentication.call(this, 'segmentApi', options);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user