mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
dec19585bc
* refactor: Enforce expanded sensitive inputs rules (no-changelog) * refactor: Add extra exemption * fix: Add setting to `sessionToken` fields * fix: Restore for `hidden` fields * fix: More edge case exemptions * fix: One more
34 lines
754 B
TypeScript
34 lines
754 B
TypeScript
import type {
|
|
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',
|
|
typeOptions: { password: true },
|
|
default: '',
|
|
},
|
|
];
|
|
|
|
async authenticate(
|
|
credentials: ICredentialDataDecryptedObject,
|
|
requestOptions: IHttpRequestOptions,
|
|
): Promise<IHttpRequestOptions> {
|
|
const base64Key = Buffer.from(`${credentials.writekey}:`).toString('base64');
|
|
requestOptions.headers!.Authorization = `Basic ${base64Key}`;
|
|
return requestOptions;
|
|
}
|
|
}
|