From e29c5975e1f1ad089167df46021203e9f67c8ef1 Mon Sep 17 00:00:00 2001 From: Ricardo Espinoza Date: Tue, 14 Jun 2022 01:27:19 -0400 Subject: [PATCH] feat(core): Add "Client Credentials" grant type to OAuth2 (#3489) * :zap: Add OAuth2 client credentials grant type * :zap: Improvements * :bug: Fix linting issue * :bug: Fix typo * :bug: Fix small issue with type * :bug: When token expire get a new one instead of refreshing it * :zap: Fix issue that it did not display it correctly for OAuth1 Co-authored-by: Jan Oberhauser --- packages/core/src/NodeExecuteFunctions.ts | 57 +++++++++++++++---- .../CredentialEdit/CredentialEdit.vue | 14 ++++- .../AcuitySchedulingOAuth2Api.credentials.ts | 6 ++ .../credentials/AsanaOAuth2Api.credentials.ts | 6 ++ .../credentials/BitlyOAuth2Api.credentials.ts | 6 ++ .../credentials/BoxOAuth2Api.credentials.ts | 6 ++ .../CiscoWebexOAuth2Api.credentials.ts | 6 ++ .../ClickUpOAuth2Api.credentials.ts | 6 ++ .../credentials/DriftOAuth2Api.credentials.ts | 6 ++ .../DropboxOAuth2Api.credentials.ts | 6 ++ .../EventbriteOAuth2Api.credentials.ts | 6 ++ .../FormstackOAuth2Api.credentials.ts | 6 ++ .../GetResponseOAuth2Api.credentials.ts | 6 ++ .../GithubOAuth2Api.credentials.ts | 6 ++ .../GitlabOAuth2Api.credentials.ts | 6 ++ .../GoToWebinarOAuth2Api.credentials.ts | 6 ++ .../GoogleOAuth2Api.credentials.ts | 6 ++ .../HarvestOAuth2Api.credentials.ts | 6 ++ .../HelpScoutOAuth2Api.credentials.ts | 6 ++ .../HubspotDeveloperApi.credentials.ts | 6 ++ .../HubspotOAuth2Api.credentials.ts | 6 ++ .../credentials/KeapOAuth2Api.credentials.ts | 6 ++ .../LineNotifyOAuth2Api.credentials.ts | 6 ++ .../LinkedInOAuth2Api.credentials.ts | 6 ++ .../MailchimpOAuth2Api.credentials.ts | 6 ++ .../MauticOAuth2Api.credentials.ts | 6 ++ .../MediumOAuth2Api.credentials.ts | 6 ++ .../MicrosoftOAuth2Api.credentials.ts | 6 ++ .../MondayComOAuth2Api.credentials.ts | 6 ++ .../NextCloudOAuth2Api.credentials.ts | 6 ++ .../NotionOAuth2Api.credentials.ts | 6 ++ .../credentials/OAuth2Api.credentials.ts | 37 ++++++++++++ .../PagerDutyOAuth2Api.credentials.ts | 6 ++ .../PhilipsHueOAuth2Api.credentials.ts | 6 ++ .../PipedriveOAuth2Api.credentials.ts | 6 ++ .../PushbulletOAuth2Api.credentials.ts | 6 ++ .../QuickBooksOAuth2Api.credentials.ts | 6 ++ .../RaindropOAuth2Api.credentials.ts | 6 ++ .../RedditOAuth2Api.credentials.ts | 6 ++ .../SalesforceOAuth2Api.credentials.ts | 6 ++ .../SentryIoOAuth2Api.credentials.ts | 6 ++ .../ServiceNowOAuth2Api.credentials.ts | 6 ++ .../credentials/SlackOAuth2Api.credentials.ts | 6 ++ .../SpotifyOAuth2Api.credentials.ts | 6 ++ .../StravaOAuth2Api.credentials.ts | 6 ++ .../SurveyMonkeyOAuth2Api.credentials.ts | 6 ++ .../TodoistOAuth2Api.credentials.ts | 6 ++ .../credentials/TwistOAuth2Api.credentials.ts | 6 ++ .../TypeformOAuth2Api.credentials.ts | 6 ++ .../WebflowOAuth2Api.credentials.ts | 6 ++ .../credentials/XeroOAuth2Api.credentials.ts | 6 ++ .../ZendeskOAuth2Api.credentials.ts | 6 ++ .../credentials/ZohoOAuth2Api.credentials.ts | 6 ++ .../credentials/ZoomOAuth2Api.credentials.ts | 6 ++ packages/workflow/src/Interfaces.ts | 16 ++++++ 55 files changed, 417 insertions(+), 13 deletions(-) diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 0d0dbfe4a4..1d93eb615b 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -57,6 +57,8 @@ import { WorkflowExecuteMode, LoggerProxy as Logger, IExecuteData, + OAuth2GrantType, + IOAuth2Credentials, } from 'n8n-workflow'; import { Agent } from 'https'; @@ -881,19 +883,46 @@ export async function requestOAuth2( oAuth2Options?: IOAuth2Options, isN8nRequest = false, ) { - const credentials = await this.getCredentials(credentialsType); + const credentials = (await this.getCredentials(credentialsType)) as unknown as IOAuth2Credentials; - if (credentials.oauthTokenData === undefined) { + // Only the OAuth2 with authorization code grant needs connection + if ( + credentials.grantType === OAuth2GrantType.authorizationCode && + credentials.oauthTokenData === undefined + ) { throw new Error('OAuth credentials not connected!'); } const oAuthClient = new clientOAuth2({ - clientId: credentials.clientId as string, - clientSecret: credentials.clientSecret as string, - accessTokenUri: credentials.accessTokenUrl as string, + clientId: credentials.clientId, + clientSecret: credentials.clientSecret, + accessTokenUri: credentials.accessTokenUrl, + scopes: credentials.scope.split(' '), }); - const oauthTokenData = credentials.oauthTokenData as clientOAuth2.Data; + let oauthTokenData = credentials.oauthTokenData as clientOAuth2.Data; + // if it's the first time using the credentials, get the access token and save it into the DB. + if (credentials.grantType === OAuth2GrantType.clientCredentials && oauthTokenData === undefined) { + const { data } = await oAuthClient.credentials.getToken(); + + // Find the credentials + if (!node.credentials || !node.credentials[credentialsType]) { + throw new Error( + `The node "${node.name}" does not have credentials of type "${credentialsType}"!`, + ); + } + + const nodeCredentials = node.credentials[credentialsType]; + + // Save the refreshed token + await additionalData.credentialsHelper.updateCredentials( + nodeCredentials, + credentialsType, + credentials as unknown as ICredentialDataDecryptedObject, + ); + + oauthTokenData = data; + } const token = oAuthClient.createToken( get(oauthTokenData, oAuth2Options?.property as string) || oauthTokenData.accessToken, @@ -926,8 +955,8 @@ export async function requestOAuth2( if (oAuth2Options?.includeCredentialsOnRefreshOnBody) { const body: IDataObject = { - client_id: credentials.clientId as string, - client_secret: credentials.clientSecret as string, + client_id: credentials.clientId, + client_secret: credentials.clientSecret, }; tokenRefreshOptions.body = body; // Override authorization property so the credentails are not included in it @@ -940,7 +969,15 @@ export async function requestOAuth2( `OAuth2 token for "${credentialsType}" used by node "${node.name}" expired. Should revalidate.`, ); - const newToken = await token.refresh(tokenRefreshOptions); + let newToken; + + // if it's OAuth2 with client credentials grant type, get a new token + // instead of refreshing it. + if (OAuth2GrantType.clientCredentials === credentials.grantType) { + newToken = await token.client.credentials.getToken(); + } else { + newToken = await token.refresh(tokenRefreshOptions); + } Logger.debug( `OAuth2 token for "${credentialsType}" used by node "${node.name}" has been renewed.`, @@ -960,7 +997,7 @@ export async function requestOAuth2( await additionalData.credentialsHelper.updateCredentials( nodeCredentials, credentialsType, - credentials, + credentials as unknown as ICredentialDataDecryptedObject, ); Logger.debug( diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue index 5b42ce9036..6b79502bcb 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue @@ -299,9 +299,17 @@ export default mixins(showMessage, nodeHelpers).extend({ }, isOAuthType(): boolean { return !!this.credentialTypeName && ( - ['oAuth1Api', 'oAuth2Api'].includes(this.credentialTypeName) || - this.parentTypes.includes('oAuth1Api') || - this.parentTypes.includes('oAuth2Api') + ( + ( + this.credentialTypeName === 'oAuth2Api' || + this.parentTypes.includes('oAuth2Api') + ) && this.credentialData.grantType === 'authorizationCode' + ) + || + ( + this.credentialTypeName === 'oAuth1Api' || + this.parentTypes.includes('oAuth1Api') + ) ); }, isOAuthConnected(): boolean { diff --git a/packages/nodes-base/credentials/AcuitySchedulingOAuth2Api.credentials.ts b/packages/nodes-base/credentials/AcuitySchedulingOAuth2Api.credentials.ts index b9526517c9..e5b4832b55 100644 --- a/packages/nodes-base/credentials/AcuitySchedulingOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/AcuitySchedulingOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class AcuitySchedulingOAuth2Api implements ICredentialType { displayName = 'AcuityScheduling OAuth2 API'; documentationUrl = 'acuityScheduling'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/AsanaOAuth2Api.credentials.ts b/packages/nodes-base/credentials/AsanaOAuth2Api.credentials.ts index 918425eb64..f1a5d54e3a 100644 --- a/packages/nodes-base/credentials/AsanaOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/AsanaOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class AsanaOAuth2Api implements ICredentialType { displayName = 'Asana OAuth2 API'; documentationUrl = 'asana'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/BitlyOAuth2Api.credentials.ts b/packages/nodes-base/credentials/BitlyOAuth2Api.credentials.ts index 2db80630c8..d60dd421fc 100644 --- a/packages/nodes-base/credentials/BitlyOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/BitlyOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class BitlyOAuth2Api implements ICredentialType { 'oAuth2Api', ]; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/BoxOAuth2Api.credentials.ts b/packages/nodes-base/credentials/BoxOAuth2Api.credentials.ts index f900954e55..527da9dc9d 100644 --- a/packages/nodes-base/credentials/BoxOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/BoxOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class BoxOAuth2Api implements ICredentialType { displayName = 'Box OAuth2 API'; documentationUrl = 'box'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/CiscoWebexOAuth2Api.credentials.ts b/packages/nodes-base/credentials/CiscoWebexOAuth2Api.credentials.ts index c728e626f5..2c96fe93fd 100644 --- a/packages/nodes-base/credentials/CiscoWebexOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/CiscoWebexOAuth2Api.credentials.ts @@ -10,6 +10,12 @@ export class CiscoWebexOAuth2Api implements ICredentialType { ]; displayName = 'Cisco Webex OAuth2 API'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/ClickUpOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ClickUpOAuth2Api.credentials.ts index b9ed95ea28..82dcdbf407 100644 --- a/packages/nodes-base/credentials/ClickUpOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/ClickUpOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class ClickUpOAuth2Api implements ICredentialType { displayName = 'ClickUp OAuth2 API'; documentationUrl = 'clickUp'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/DriftOAuth2Api.credentials.ts b/packages/nodes-base/credentials/DriftOAuth2Api.credentials.ts index 3fa072d66d..1d1fc9386b 100644 --- a/packages/nodes-base/credentials/DriftOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/DriftOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class DriftOAuth2Api implements ICredentialType { displayName = 'Drift OAuth2 API'; documentationUrl = 'drift'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/DropboxOAuth2Api.credentials.ts b/packages/nodes-base/credentials/DropboxOAuth2Api.credentials.ts index 6ac0b512d3..8459644453 100644 --- a/packages/nodes-base/credentials/DropboxOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/DropboxOAuth2Api.credentials.ts @@ -18,6 +18,12 @@ export class DropboxOAuth2Api implements ICredentialType { displayName = 'Dropbox OAuth2 API'; documentationUrl = 'dropbox'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/EventbriteOAuth2Api.credentials.ts b/packages/nodes-base/credentials/EventbriteOAuth2Api.credentials.ts index ea339573ae..cbfb2b4d0b 100644 --- a/packages/nodes-base/credentials/EventbriteOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/EventbriteOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class EventbriteOAuth2Api implements ICredentialType { displayName = 'Eventbrite OAuth2 API'; documentationUrl = 'eventbrite'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/FormstackOAuth2Api.credentials.ts b/packages/nodes-base/credentials/FormstackOAuth2Api.credentials.ts index fc83e1187e..6d90f0441e 100644 --- a/packages/nodes-base/credentials/FormstackOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/FormstackOAuth2Api.credentials.ts @@ -13,6 +13,12 @@ export class FormstackOAuth2Api implements ICredentialType { displayName = 'Formstack OAuth2 API'; documentationUrl = 'formstackTrigger'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/GetResponseOAuth2Api.credentials.ts b/packages/nodes-base/credentials/GetResponseOAuth2Api.credentials.ts index 9bd8e6a61e..98696ed33a 100644 --- a/packages/nodes-base/credentials/GetResponseOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/GetResponseOAuth2Api.credentials.ts @@ -10,6 +10,12 @@ export class GetResponseOAuth2Api implements ICredentialType { ]; displayName = 'GetResponse OAuth2 API'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/GithubOAuth2Api.credentials.ts b/packages/nodes-base/credentials/GithubOAuth2Api.credentials.ts index 401b44825f..40f2def13e 100644 --- a/packages/nodes-base/credentials/GithubOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/GithubOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class GithubOAuth2Api implements ICredentialType { displayName = 'GitHub OAuth2 API'; documentationUrl = 'github'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Github Server', name: 'server', diff --git a/packages/nodes-base/credentials/GitlabOAuth2Api.credentials.ts b/packages/nodes-base/credentials/GitlabOAuth2Api.credentials.ts index 2f49e4caed..6ed5a06868 100644 --- a/packages/nodes-base/credentials/GitlabOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/GitlabOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class GitlabOAuth2Api implements ICredentialType { displayName = 'GitLab OAuth2 API'; documentationUrl = 'gitlab'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Gitlab Server', name: 'server', diff --git a/packages/nodes-base/credentials/GoToWebinarOAuth2Api.credentials.ts b/packages/nodes-base/credentials/GoToWebinarOAuth2Api.credentials.ts index e21166610a..afc0264814 100644 --- a/packages/nodes-base/credentials/GoToWebinarOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/GoToWebinarOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class GoToWebinarOAuth2Api implements ICredentialType { displayName = 'GoToWebinar OAuth2 API'; documentationUrl = 'goToWebinar'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/GoogleOAuth2Api.credentials.ts b/packages/nodes-base/credentials/GoogleOAuth2Api.credentials.ts index 241c6e051d..82027c9282 100644 --- a/packages/nodes-base/credentials/GoogleOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/GoogleOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class GoogleOAuth2Api implements ICredentialType { documentationUrl = 'google'; icon = 'file:Google.svg'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/HarvestOAuth2Api.credentials.ts b/packages/nodes-base/credentials/HarvestOAuth2Api.credentials.ts index 9a9a454f8d..6d71477ba2 100644 --- a/packages/nodes-base/credentials/HarvestOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/HarvestOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class HarvestOAuth2Api implements ICredentialType { ]; displayName = 'Harvest OAuth2 API'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/HelpScoutOAuth2Api.credentials.ts b/packages/nodes-base/credentials/HelpScoutOAuth2Api.credentials.ts index 1b6252bc50..85aa345c19 100644 --- a/packages/nodes-base/credentials/HelpScoutOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/HelpScoutOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class HelpScoutOAuth2Api implements ICredentialType { displayName = 'HelpScout OAuth2 API'; documentationUrl = 'helpScout'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/HubspotDeveloperApi.credentials.ts b/packages/nodes-base/credentials/HubspotDeveloperApi.credentials.ts index e03782052c..a3d66aa8a1 100644 --- a/packages/nodes-base/credentials/HubspotDeveloperApi.credentials.ts +++ b/packages/nodes-base/credentials/HubspotDeveloperApi.credentials.ts @@ -20,6 +20,12 @@ export class HubspotDeveloperApi implements ICredentialType { 'oAuth2Api', ]; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/HubspotOAuth2Api.credentials.ts b/packages/nodes-base/credentials/HubspotOAuth2Api.credentials.ts index fd31a368d9..0e3e21a06f 100644 --- a/packages/nodes-base/credentials/HubspotOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/HubspotOAuth2Api.credentials.ts @@ -26,6 +26,12 @@ export class HubspotOAuth2Api implements ICredentialType { displayName = 'HubSpot OAuth2 API'; documentationUrl = 'hubspot'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/KeapOAuth2Api.credentials.ts b/packages/nodes-base/credentials/KeapOAuth2Api.credentials.ts index b123e5e29f..3f62fc0f88 100644 --- a/packages/nodes-base/credentials/KeapOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/KeapOAuth2Api.credentials.ts @@ -15,6 +15,12 @@ export class KeapOAuth2Api implements ICredentialType { displayName = 'Keap OAuth2 API'; documentationUrl = 'keap'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/LineNotifyOAuth2Api.credentials.ts b/packages/nodes-base/credentials/LineNotifyOAuth2Api.credentials.ts index 618b0e1d20..3d63f20f90 100644 --- a/packages/nodes-base/credentials/LineNotifyOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/LineNotifyOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class LineNotifyOAuth2Api implements ICredentialType { displayName = 'Line Notify OAuth2 API'; documentationUrl = 'line'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/LinkedInOAuth2Api.credentials.ts b/packages/nodes-base/credentials/LinkedInOAuth2Api.credentials.ts index 100e9ec779..012b5795ba 100644 --- a/packages/nodes-base/credentials/LinkedInOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/LinkedInOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class LinkedInOAuth2Api implements ICredentialType { displayName = 'LinkedIn OAuth2 API'; documentationUrl = 'linkedIn'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Organization Support', name: 'organizationSupport', diff --git a/packages/nodes-base/credentials/MailchimpOAuth2Api.credentials.ts b/packages/nodes-base/credentials/MailchimpOAuth2Api.credentials.ts index 3cd433efb2..392fadbecc 100644 --- a/packages/nodes-base/credentials/MailchimpOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/MailchimpOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class MailchimpOAuth2Api implements ICredentialType { displayName = 'Mailchimp OAuth2 API'; documentationUrl = 'mailchimp'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/MauticOAuth2Api.credentials.ts b/packages/nodes-base/credentials/MauticOAuth2Api.credentials.ts index ea5e131ded..58e4898c36 100644 --- a/packages/nodes-base/credentials/MauticOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/MauticOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class MauticOAuth2Api implements ICredentialType { displayName = 'Mautic OAuth2 API'; documentationUrl = 'mautic'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'URL', name: 'url', diff --git a/packages/nodes-base/credentials/MediumOAuth2Api.credentials.ts b/packages/nodes-base/credentials/MediumOAuth2Api.credentials.ts index 5f01fcfda8..1f9ae1199f 100644 --- a/packages/nodes-base/credentials/MediumOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/MediumOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class MediumOAuth2Api implements ICredentialType { displayName = 'Medium OAuth2 API'; documentationUrl = 'medium'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/MicrosoftOAuth2Api.credentials.ts b/packages/nodes-base/credentials/MicrosoftOAuth2Api.credentials.ts index 193c056fb5..d491e4b5fe 100644 --- a/packages/nodes-base/credentials/MicrosoftOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/MicrosoftOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class MicrosoftOAuth2Api implements ICredentialType { displayName = 'Microsoft OAuth2 API'; documentationUrl = 'microsoft'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, //info about the tenantID //https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints { diff --git a/packages/nodes-base/credentials/MondayComOAuth2Api.credentials.ts b/packages/nodes-base/credentials/MondayComOAuth2Api.credentials.ts index dbd3dd512f..b4ab8efde1 100644 --- a/packages/nodes-base/credentials/MondayComOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/MondayComOAuth2Api.credentials.ts @@ -16,6 +16,12 @@ export class MondayComOAuth2Api implements ICredentialType { displayName = 'Monday.com OAuth2 API'; documentationUrl = 'monday'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/NextCloudOAuth2Api.credentials.ts b/packages/nodes-base/credentials/NextCloudOAuth2Api.credentials.ts index 67af8dad11..e3acd84de0 100644 --- a/packages/nodes-base/credentials/NextCloudOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/NextCloudOAuth2Api.credentials.ts @@ -12,6 +12,12 @@ export class NextCloudOAuth2Api implements ICredentialType { displayName = 'NextCloud OAuth2 API'; documentationUrl = 'nextCloud'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Web DAV URL', name: 'webDavUrl', diff --git a/packages/nodes-base/credentials/NotionOAuth2Api.credentials.ts b/packages/nodes-base/credentials/NotionOAuth2Api.credentials.ts index e9fe60abfe..845f7bc4e3 100644 --- a/packages/nodes-base/credentials/NotionOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/NotionOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class NotionOAuth2Api implements ICredentialType { displayName = 'Notion OAuth2 API'; documentationUrl = 'notion'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/OAuth2Api.credentials.ts b/packages/nodes-base/credentials/OAuth2Api.credentials.ts index f68b5fa25c..2bb90f4359 100644 --- a/packages/nodes-base/credentials/OAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/OAuth2Api.credentials.ts @@ -10,10 +10,33 @@ export class OAuth2Api implements ICredentialType { documentationUrl = 'httpRequest'; genericAuth = true; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'options', + options: [ + { + name: 'Authorization Code', + value: 'authorizationCode', + }, + { + name: 'Client Credentials', + value: 'clientCredentials', + }, + ], + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', type: 'string', + displayOptions: { + show: { + grantType: [ + 'authorizationCode', + ], + }, + }, default: '', required: true, }, @@ -51,6 +74,13 @@ export class OAuth2Api implements ICredentialType { displayName: 'Auth URI Query Parameters', name: 'authQueryParameters', type: 'string', + displayOptions: { + show: { + grantType: [ + 'authorizationCode', + ], + }, + }, default: '', description: 'For some services additional query parameters have to be set which can be defined here', placeholder: 'access_type=offline', @@ -59,6 +89,13 @@ export class OAuth2Api implements ICredentialType { displayName: 'Authentication', name: 'authentication', type: 'options', + displayOptions: { + show: { + grantType: [ + 'authorizationCode', + ], + }, + }, options: [ { name: 'Body', diff --git a/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts b/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts index a14961d303..c1af87cd64 100644 --- a/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/PagerDutyOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class PagerDutyOAuth2Api implements ICredentialType { displayName = 'PagerDuty OAuth2 API'; documentationUrl = 'pagerDuty'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/PhilipsHueOAuth2Api.credentials.ts b/packages/nodes-base/credentials/PhilipsHueOAuth2Api.credentials.ts index c5ed89b6f6..1222627d61 100644 --- a/packages/nodes-base/credentials/PhilipsHueOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/PhilipsHueOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class PhilipsHueOAuth2Api implements ICredentialType { displayName = 'PhilipHue OAuth2 API'; documentationUrl = 'philipsHue'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'APP ID', name: 'appId', diff --git a/packages/nodes-base/credentials/PipedriveOAuth2Api.credentials.ts b/packages/nodes-base/credentials/PipedriveOAuth2Api.credentials.ts index 19ab08b823..f82fb5af32 100644 --- a/packages/nodes-base/credentials/PipedriveOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/PipedriveOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class PipedriveOAuth2Api implements ICredentialType { displayName = 'Pipedrive OAuth2 API'; documentationUrl = 'pipedrive'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/PushbulletOAuth2Api.credentials.ts b/packages/nodes-base/credentials/PushbulletOAuth2Api.credentials.ts index 7be6b14fbc..891e04b123 100644 --- a/packages/nodes-base/credentials/PushbulletOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/PushbulletOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class PushbulletOAuth2Api implements ICredentialType { displayName = 'Pushbullet OAuth2 API'; documentationUrl = 'pushbullet'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/QuickBooksOAuth2Api.credentials.ts b/packages/nodes-base/credentials/QuickBooksOAuth2Api.credentials.ts index d1683dea49..3a7ed6b17c 100644 --- a/packages/nodes-base/credentials/QuickBooksOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/QuickBooksOAuth2Api.credentials.ts @@ -13,6 +13,12 @@ export class QuickBooksOAuth2Api implements ICredentialType { displayName = 'QuickBooks Online OAuth2 API'; documentationUrl = 'quickbooks'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/RaindropOAuth2Api.credentials.ts b/packages/nodes-base/credentials/RaindropOAuth2Api.credentials.ts index abe26491dd..5940bff4a7 100644 --- a/packages/nodes-base/credentials/RaindropOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/RaindropOAuth2Api.credentials.ts @@ -13,6 +13,12 @@ export class RaindropOAuth2Api implements ICredentialType { displayName = 'Raindrop OAuth2 API'; documentationUrl = 'raindrop'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/RedditOAuth2Api.credentials.ts b/packages/nodes-base/credentials/RedditOAuth2Api.credentials.ts index b800a03b7f..03cab714fb 100644 --- a/packages/nodes-base/credentials/RedditOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/RedditOAuth2Api.credentials.ts @@ -23,6 +23,12 @@ export class RedditOAuth2Api implements ICredentialType { displayName = 'Reddit OAuth2 API'; documentationUrl = 'reddit'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Auth URI Query Parameters', name: 'authQueryParameters', diff --git a/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts b/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts index 517fde6f5b..b46e58295a 100644 --- a/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/SalesforceOAuth2Api.credentials.ts @@ -27,6 +27,12 @@ export class SalesforceOAuth2Api implements ICredentialType { ], default: 'production', }, + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/SentryIoOAuth2Api.credentials.ts b/packages/nodes-base/credentials/SentryIoOAuth2Api.credentials.ts index d1d8893017..596ec6936b 100644 --- a/packages/nodes-base/credentials/SentryIoOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/SentryIoOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class SentryIoOAuth2Api implements ICredentialType { displayName = 'Sentry.io OAuth2 API'; documentationUrl = 'sentryIo'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/ServiceNowOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ServiceNowOAuth2Api.credentials.ts index 4bd0bc2e19..4877bd5c53 100644 --- a/packages/nodes-base/credentials/ServiceNowOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/ServiceNowOAuth2Api.credentials.ts @@ -19,6 +19,12 @@ export class ServiceNowOAuth2Api implements ICredentialType { hint: 'The subdomain can be extracted from the URL. If the URL is: https://dev99890.service-now.com the subdomain is dev99890', required: true, }, + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/SlackOAuth2Api.credentials.ts b/packages/nodes-base/credentials/SlackOAuth2Api.credentials.ts index fa8efae44c..f8e7cacebd 100644 --- a/packages/nodes-base/credentials/SlackOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/SlackOAuth2Api.credentials.ts @@ -30,6 +30,12 @@ export class SlackOAuth2Api implements ICredentialType { displayName = 'Slack OAuth2 API'; documentationUrl = 'slack'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/SpotifyOAuth2Api.credentials.ts b/packages/nodes-base/credentials/SpotifyOAuth2Api.credentials.ts index 7dcce7ae75..7da55605c7 100644 --- a/packages/nodes-base/credentials/SpotifyOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/SpotifyOAuth2Api.credentials.ts @@ -18,6 +18,12 @@ export class SpotifyOAuth2Api implements ICredentialType { type: 'hidden', default: 'https://api.spotify.com/', }, + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/StravaOAuth2Api.credentials.ts b/packages/nodes-base/credentials/StravaOAuth2Api.credentials.ts index 9769aeebe0..6c2bb32617 100644 --- a/packages/nodes-base/credentials/StravaOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/StravaOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class StravaOAuth2Api implements ICredentialType { displayName = 'Strava OAuth2 API'; documentationUrl = 'strava'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/SurveyMonkeyOAuth2Api.credentials.ts b/packages/nodes-base/credentials/SurveyMonkeyOAuth2Api.credentials.ts index 6ba7970986..6626c8d48f 100644 --- a/packages/nodes-base/credentials/SurveyMonkeyOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/SurveyMonkeyOAuth2Api.credentials.ts @@ -20,6 +20,12 @@ export class SurveyMonkeyOAuth2Api implements ICredentialType { displayName = 'SurveyMonkey OAuth2 API'; documentationUrl = 'surveyMonkey'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/TodoistOAuth2Api.credentials.ts b/packages/nodes-base/credentials/TodoistOAuth2Api.credentials.ts index 6547c773dd..ab0c5371c9 100644 --- a/packages/nodes-base/credentials/TodoistOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/TodoistOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class TodoistOAuth2Api implements ICredentialType { displayName = 'Todoist OAuth2 API'; documentationUrl = 'todoist'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/TwistOAuth2Api.credentials.ts b/packages/nodes-base/credentials/TwistOAuth2Api.credentials.ts index 3f0011ac49..971edfc48f 100644 --- a/packages/nodes-base/credentials/TwistOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/TwistOAuth2Api.credentials.ts @@ -20,6 +20,12 @@ export class TwistOAuth2Api implements ICredentialType { displayName = 'Twist OAuth2 API'; documentationUrl = 'twist'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/TypeformOAuth2Api.credentials.ts b/packages/nodes-base/credentials/TypeformOAuth2Api.credentials.ts index 79c629632f..ab7efa81c1 100644 --- a/packages/nodes-base/credentials/TypeformOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/TypeformOAuth2Api.credentials.ts @@ -17,6 +17,12 @@ export class TypeformOAuth2Api implements ICredentialType { displayName = 'Typeform OAuth2 API'; documentationUrl = 'typeform'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/WebflowOAuth2Api.credentials.ts b/packages/nodes-base/credentials/WebflowOAuth2Api.credentials.ts index 653b114c2e..56b3bb0bad 100644 --- a/packages/nodes-base/credentials/WebflowOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/WebflowOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class WebflowOAuth2Api implements ICredentialType { displayName = 'Webflow OAuth2 API'; documentationUrl = 'webflow'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/XeroOAuth2Api.credentials.ts b/packages/nodes-base/credentials/XeroOAuth2Api.credentials.ts index 04d7f88c59..79fb3a9ad6 100644 --- a/packages/nodes-base/credentials/XeroOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/XeroOAuth2Api.credentials.ts @@ -18,6 +18,12 @@ export class XeroOAuth2Api implements ICredentialType { displayName = 'Xero OAuth2 API'; documentationUrl = 'xero'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/ZendeskOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ZendeskOAuth2Api.credentials.ts index e37a1f125a..feba9ca66a 100644 --- a/packages/nodes-base/credentials/ZendeskOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/ZendeskOAuth2Api.credentials.ts @@ -25,6 +25,12 @@ export class ZendeskOAuth2Api implements ICredentialType { description: 'The subdomain of your Zendesk work environment', required: true, }, + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/ZohoOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ZohoOAuth2Api.credentials.ts index 811efaeee3..86a966f4aa 100644 --- a/packages/nodes-base/credentials/ZohoOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/ZohoOAuth2Api.credentials.ts @@ -11,6 +11,12 @@ export class ZohoOAuth2Api implements ICredentialType { displayName = 'Zoho OAuth2 API'; documentationUrl = 'zoho'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts b/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts index db38dd541c..7268aaba14 100644 --- a/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts +++ b/packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts @@ -9,6 +9,12 @@ export class ZoomOAuth2Api implements ICredentialType { displayName = 'Zoom OAuth2 API'; documentationUrl = 'zoom'; properties: INodeProperties[] = [ + { + displayName: 'Grant Type', + name: 'grantType', + type: 'hidden', + default: 'authorizationCode', + }, { displayName: 'Authorization URL', name: 'authUrl', diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index 0e9d8888ea..bca49df274 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -1535,3 +1535,19 @@ export interface IConnectedNode { indicies: number[]; depth: number; } + +export enum OAuth2GrantType { + authorizationCode = 'authorizationCode', + clientCredentials = 'clientCredentials', +} +export interface IOAuth2Credentials { + grantType: 'authorizationCode' | 'clientCredentials'; + clientId: string; + clientSecret: string; + accessTokenUrl: string; + authUrl: string; + authQueryParameters: string; + authentication: 'body' | 'header'; + scope: string; + oauthTokenData?: IDataObject; +}