2020-06-08 05:40:23 -07:00
|
|
|
import {
|
|
|
|
ICredentialType,
|
2021-06-12 09:39:55 -07:00
|
|
|
INodeProperties,
|
2020-06-08 05:40:23 -07:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2020-06-13 16:48:24 -07:00
|
|
|
const scopes = [
|
2021-12-10 11:28:59 -08:00
|
|
|
'crm.schemas.deals.read',
|
|
|
|
'crm.objects.owners.read',
|
|
|
|
'crm.objects.contacts.write',
|
|
|
|
'crm.objects.companies.write',
|
|
|
|
'crm.objects.companies.read',
|
|
|
|
'crm.objects.deals.read',
|
|
|
|
'crm.schemas.contacts.read',
|
|
|
|
'crm.objects.deals.write',
|
|
|
|
'crm.objects.contacts.read',
|
|
|
|
'crm.schemas.companies.read',
|
2020-06-13 16:48:24 -07:00
|
|
|
'forms',
|
|
|
|
'tickets',
|
|
|
|
];
|
|
|
|
|
2020-06-08 05:40:23 -07:00
|
|
|
export class HubspotOAuth2Api implements ICredentialType {
|
|
|
|
name = 'hubspotOAuth2Api';
|
|
|
|
extends = [
|
|
|
|
'oAuth2Api',
|
|
|
|
];
|
2022-05-24 02:36:19 -07:00
|
|
|
displayName = 'HubSpot OAuth2 API';
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'hubspot';
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2020-06-08 05:40:23 -07:00
|
|
|
{
|
|
|
|
displayName: 'Authorization URL',
|
|
|
|
name: 'authUrl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-06-08 05:40:23 -07:00
|
|
|
default: 'https://app.hubspot.com/oauth/authorize',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token URL',
|
|
|
|
name: 'accessTokenUrl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-06-08 05:40:23 -07:00
|
|
|
default: 'https://api.hubapi.com/oauth/v1/token',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-06-13 16:48:24 -07:00
|
|
|
default: scopes.join(' '),
|
2020-06-08 05:40:23 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-06-08 05:40:23 -07:00
|
|
|
default: 'grant_type=authorization_code',
|
|
|
|
},
|
|
|
|
{
|
2020-10-01 05:01:39 -07:00
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-10-01 05:01:39 -07:00
|
|
|
default: 'body',
|
|
|
|
},
|
2020-06-08 05:40:23 -07:00
|
|
|
];
|
|
|
|
}
|