mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
76f9ad8bae
* Add credential injection and testing to Lemlist, Uproc, Supabase, Segment, Phantombuster, Mailgun and Dropcontact
29 lines
712 B
TypeScript
29 lines
712 B
TypeScript
import {
|
|
ICredentialDataDecryptedObject,
|
|
ICredentialType,
|
|
IHttpRequestOptions,
|
|
INodeProperties,
|
|
} from 'n8n-workflow';
|
|
|
|
export class SegmentApi implements ICredentialType {
|
|
name = 'segmentApi';
|
|
displayName = 'Segment API';
|
|
documentationUrl = 'segment';
|
|
properties: INodeProperties[] = [
|
|
{
|
|
displayName: 'Write Key',
|
|
name: 'writekey',
|
|
type: 'string',
|
|
default: '',
|
|
},
|
|
];
|
|
async authenticate(
|
|
credentials: ICredentialDataDecryptedObject,
|
|
requestOptions: IHttpRequestOptions,
|
|
): Promise<IHttpRequestOptions> {
|
|
const base64Key = Buffer.from(`${credentials.writekey}:`).toString('base64');
|
|
requestOptions.headers!['Authorization'] = `Basic ${base64Key}`;
|
|
return requestOptions;
|
|
}
|
|
}
|