mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
feat(core): Add "Client Credentials" grant type to OAuth2 (#3489)
* ⚡ Add OAuth2 client credentials grant type * ⚡ Improvements * 🐛 Fix linting issue * 🐛 Fix typo * 🐛 Fix small issue with type * 🐛 When token expire get a new one instead of refreshing it * ⚡ Fix issue that it did not display it correctly for OAuth1 Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
51663c1fcb
commit
e29c5975e1
|
@ -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(
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue