mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
OAuth2: credentials, genericFunctions, UI
This commit is contained in:
@@ -49,6 +49,24 @@ export class SurveyMonkeyTrigger implements INodeType {
|
||||
{
|
||||
name: 'surveyMonkeyApi',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'surveyMonkeyOAuth2Api',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
webhooks: [
|
||||
@@ -66,6 +84,23 @@ export class SurveyMonkeyTrigger implements INodeType {
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Access Token',
|
||||
value: 'accessToken',
|
||||
},
|
||||
{
|
||||
name: 'OAuth2',
|
||||
value: 'oAuth2',
|
||||
},
|
||||
],
|
||||
default: 'accessToken',
|
||||
description: 'Method of authentication.',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'objectType',
|
||||
@@ -453,11 +488,18 @@ export class SurveyMonkeyTrigger implements INodeType {
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
const objectType = this.getNodeParameter('objectType') as string;
|
||||
const credentials = this.getCredentials('surveyMonkeyApi') as IDataObject;
|
||||
const authenticationMethod = this.getNodeParameter('authentication') as string;
|
||||
let credentials : IDataObject;
|
||||
const headerData = this.getHeaderData() as IDataObject;
|
||||
const req = this.getRequestObject();
|
||||
const webhookName = this.getWebhookName();
|
||||
|
||||
if (authenticationMethod === 'accessToken') {
|
||||
credentials = this.getCredentials('surveyMonkeyApi') as IDataObject;
|
||||
} else {
|
||||
credentials = this.getCredentials('surveyMonkeyOAuth2Api') as IDataObject;
|
||||
}
|
||||
|
||||
if (webhookName === 'setup') {
|
||||
// It is a create webhook confirmation request
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user