mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
✨ OAuth1 support for HTTP Request Node (#781)
* Add OAuth1
* ✅ Added OAuth1 support.
Changes to NodeExecuteFunctions:
- Accommodating to use of both a URL and URI property in request options.
- qs if not set is undefined, so checking for its length returns an error
This commit is contained in:
@@ -71,6 +71,17 @@ export class HttpRequest implements INodeType {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'oAuth1Api',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth1',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'oAuth2Api',
|
||||
required: true,
|
||||
@@ -101,6 +112,10 @@ export class HttpRequest implements INodeType {
|
||||
name: 'Header Auth',
|
||||
value: 'headerAuth'
|
||||
},
|
||||
{
|
||||
name: 'OAuth1',
|
||||
value: 'oAuth1'
|
||||
},
|
||||
{
|
||||
name: 'OAuth2',
|
||||
value: 'oAuth2'
|
||||
@@ -578,6 +593,7 @@ export class HttpRequest implements INodeType {
|
||||
const httpBasicAuth = this.getCredentials('httpBasicAuth');
|
||||
const httpDigestAuth = this.getCredentials('httpDigestAuth');
|
||||
const httpHeaderAuth = this.getCredentials('httpHeaderAuth');
|
||||
const oAuth1Api = this.getCredentials('oAuth1Api');
|
||||
const oAuth2Api = this.getCredentials('oAuth2Api');
|
||||
|
||||
let requestOptions: OptionsWithUri;
|
||||
@@ -799,8 +815,11 @@ export class HttpRequest implements INodeType {
|
||||
}
|
||||
try {
|
||||
// Now that the options are all set make the actual http request
|
||||
|
||||
if (oAuth2Api !== undefined) {
|
||||
if (oAuth1Api !== undefined) {
|
||||
//@ts-ignore
|
||||
response = await this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions);
|
||||
}
|
||||
else if (oAuth2Api !== undefined) {
|
||||
//@ts-ignore
|
||||
response = await this.helpers.requestOAuth2.call(this, 'oAuth2Api', requestOptions, 'Bearer');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user