2020-06-08 05:40:23 -07:00
|
|
|
import {
|
|
|
|
ICredentialType,
|
|
|
|
NodePropertyTypes,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2020-06-13 16:48:24 -07:00
|
|
|
const scopes = [
|
|
|
|
'contacts',
|
|
|
|
'forms',
|
|
|
|
'tickets',
|
|
|
|
];
|
|
|
|
|
2020-06-08 05:40:23 -07:00
|
|
|
export class HubspotOAuth2Api implements ICredentialType {
|
|
|
|
name = 'hubspotOAuth2Api';
|
|
|
|
extends = [
|
|
|
|
'oAuth2Api',
|
|
|
|
];
|
|
|
|
displayName = 'Hubspot OAuth2 API';
|
|
|
|
properties = [
|
|
|
|
{
|
|
|
|
displayName: 'Authorization URL',
|
|
|
|
name: 'authUrl',
|
|
|
|
type: 'hidden' as NodePropertyTypes,
|
|
|
|
default: 'https://app.hubspot.com/oauth/authorize',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token URL',
|
|
|
|
name: 'accessTokenUrl',
|
|
|
|
type: 'hidden' as NodePropertyTypes,
|
|
|
|
default: 'https://api.hubapi.com/oauth/v1/token',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
2020-06-13 16:48:24 -07:00
|
|
|
type: 'hidden' as NodePropertyTypes,
|
|
|
|
default: scopes.join(' '),
|
2020-06-08 05:40:23 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
|
|
|
type: 'hidden' as NodePropertyTypes,
|
|
|
|
default: 'grant_type=authorization_code',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
2020-06-13 16:48:24 -07:00
|
|
|
type: 'hidden' as NodePropertyTypes,
|
|
|
|
default: 'body',
|
2020-06-08 05:40:23 -07:00
|
|
|
description: 'Resource to consume.',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|