mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 04:47:29 -08:00
⚡ Add OAuth to HubSpot Trigger node credentials (#2166)
* 🔨 HubSpot Trigger node credentials * ⚡ Small changes * ⚡ Add breaking change message Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
parent
469ac1d912
commit
5ea4dc03b8
|
@ -2,6 +2,20 @@
|
|||
|
||||
This list shows all the versions which include breaking changes and how to upgrade.
|
||||
|
||||
## 0.139.0
|
||||
|
||||
### What changed?
|
||||
|
||||
For the HubSpot Trigger node, the authentication process has changed to OAuth2.
|
||||
|
||||
### When is action necessary?
|
||||
|
||||
If you are using the Hubspot Trigger.
|
||||
|
||||
### How to upgrade:
|
||||
|
||||
Create an app in HubSpot, use the Client ID, Client Secret, App ID, and the Developer Key, and complete the OAuth2 flow.
|
||||
|
||||
## 0.135.0
|
||||
|
||||
### What changed?
|
||||
|
|
|
@ -3,11 +3,45 @@ import {
|
|||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
const scopes = [
|
||||
'contacts',
|
||||
];
|
||||
|
||||
export class HubspotDeveloperApi implements ICredentialType {
|
||||
name = 'hubspotDeveloperApi';
|
||||
displayName = 'Hubspot Developer API';
|
||||
documentationUrl = 'hubspot';
|
||||
extends = [
|
||||
'oAuth2Api',
|
||||
];
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Authorization URL',
|
||||
name: 'authUrl',
|
||||
type: 'hidden',
|
||||
default: 'https://app.hubspot.com/oauth/authorize',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Access Token URL',
|
||||
name: 'accessTokenUrl',
|
||||
type: 'hidden',
|
||||
default: 'https://api.hubapi.com/oauth/v1/token',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden',
|
||||
default: 'grant_type=authorization_code',
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'hidden',
|
||||
default: 'body',
|
||||
description: 'Resource to consume.',
|
||||
},
|
||||
{
|
||||
displayName: 'Developer API Key',
|
||||
name: 'apiKey',
|
||||
|
@ -15,18 +49,18 @@ export class HubspotDeveloperApi implements ICredentialType {
|
|||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Client Secret',
|
||||
name: 'clientSecret',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'App ID',
|
||||
displayName: 'APP ID',
|
||||
name: 'appId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
description: 'The App ID',
|
||||
description: 'The APP ID',
|
||||
},
|
||||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'hidden',
|
||||
default: scopes.join(' '),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -370,15 +370,11 @@ export class HubspotTrigger implements INodeType {
|
|||
return {};
|
||||
}
|
||||
|
||||
// check signare if client secret is defined
|
||||
|
||||
if (credentials.clientSecret !== '') {
|
||||
const hash = `${credentials!.clientSecret}${JSON.stringify(bodyData)}`;
|
||||
const signature = createHash('sha256').update(hash).digest('hex');
|
||||
//@ts-ignore
|
||||
if (signature !== headerData['x-hubspot-signature']) {
|
||||
return {};
|
||||
}
|
||||
const hash = `${credentials!.clientSecret}${JSON.stringify(bodyData)}`;
|
||||
const signature = createHash('sha256').update(hash).digest('hex');
|
||||
//@ts-ignore
|
||||
if (signature !== headerData['x-hubspot-signature']) {
|
||||
return {};
|
||||
}
|
||||
|
||||
for (let i = 0; i < bodyData.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue