mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(Mautic Node): Fix authentication issue (#3761)
* Fixes mautic credential issue * removed unused imports Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
committed by
GitHub
parent
15d8ffd3ba
commit
fe58769b48
@@ -1,8 +1,7 @@
|
||||
import {
|
||||
ICredentialDataDecryptedObject,
|
||||
IAuthenticateGeneric,
|
||||
ICredentialTestRequest,
|
||||
ICredentialType,
|
||||
IHttpRequestOptions,
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -34,22 +33,16 @@ export class MauticApi implements ICredentialType {
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
async authenticate(
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> {
|
||||
const { url, username, password } = credentials as {
|
||||
url: string;
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
const credentialUrl = url.endsWith('/') ? `${url}api/users/self` : `${url}/api/users/self`;
|
||||
const base64Key = Buffer.from(`${username}:${password}`).toString('base64');
|
||||
requestOptions.headers!['Authorization'] = `Basic ${base64Key}`;
|
||||
requestOptions.url = credentialUrl ? credentialUrl : requestOptions.url;
|
||||
|
||||
return requestOptions;
|
||||
}
|
||||
authenticate: IAuthenticateGeneric = {
|
||||
type: 'generic',
|
||||
properties: {
|
||||
auth: {
|
||||
username: '={{$credentials.username}}',
|
||||
password: '={{$credentials.password}}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
|
||||
Reference in New Issue
Block a user