mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Now OAuth2 send authentication data in the body (#1241)
This commit is contained in:
parent
46e6212750
commit
18313e1199
|
@ -172,6 +172,10 @@ export function requestOAuth2(this: IAllExecuteFunctions, credentialsType: strin
|
||||||
client_secret: credentials.clientSecret as string,
|
client_secret: credentials.clientSecret as string,
|
||||||
};
|
};
|
||||||
tokenRefreshOptions.body = body;
|
tokenRefreshOptions.body = body;
|
||||||
|
// Override authorization property so the credentails are not included in it
|
||||||
|
tokenRefreshOptions.headers = {
|
||||||
|
Authorization: '',
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const newToken = await token.refresh(tokenRefreshOptions);
|
const newToken = await token.refresh(tokenRefreshOptions);
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class MauticOAuth2Api implements ICredentialType {
|
||||||
displayName: 'Authentication',
|
displayName: 'Authentication',
|
||||||
name: 'authentication',
|
name: 'authentication',
|
||||||
type: 'hidden' as NodePropertyTypes,
|
type: 'hidden' as NodePropertyTypes,
|
||||||
default: 'header',
|
default: 'body',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ export async function mauticApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||||
|
|
||||||
options.uri = `${credentials.url}${options.uri}`;
|
options.uri = `${credentials.url}${options.uri}`;
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
returnData = await this.helpers.requestOAuth2.call(this, 'mauticOAuth2Api', options);
|
returnData = await this.helpers.requestOAuth2.call(this, 'mauticOAuth2Api', options, { includeCredentialsOnRefreshOnBody: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnData.errors) {
|
if (returnData.errors) {
|
||||||
|
|
Loading…
Reference in a new issue