From 70fd6c0c4eb6965290f733bd836abff9fc20c0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Thu, 4 Mar 2021 16:28:25 -0300 Subject: [PATCH] :zap: Add credentials file --- .../DiscordOAuth2Api.credentials.ts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 packages/nodes-base/credentials/DiscordOAuth2Api.credentials.ts diff --git a/packages/nodes-base/credentials/DiscordOAuth2Api.credentials.ts b/packages/nodes-base/credentials/DiscordOAuth2Api.credentials.ts new file mode 100644 index 0000000000..8b0e18e549 --- /dev/null +++ b/packages/nodes-base/credentials/DiscordOAuth2Api.credentials.ts @@ -0,0 +1,56 @@ +import { + ICredentialType, + NodePropertyTypes, +} from 'n8n-workflow'; + +const scopes = [ + 'bot', + 'connections', + 'guilds', + 'identify', + 'webhook.incoming', +]; + +export class DiscordOAuth2Api implements ICredentialType { + name = 'discordOAuth2Api'; + extends = [ + 'oAuth2Api', + ]; + displayName = 'Discord OAuth2 API'; + documentationUrl = 'discord'; + properties = [ + { + displayName: 'Authorization URL', + name: 'authUrl', + type: 'hidden' as NodePropertyTypes, + default: 'https://discord.com/api/oauth2/authorize', + required: true, + }, + { + displayName: 'Access Token URL', + name: 'accessTokenUrl', + type: 'hidden' as NodePropertyTypes, + default: 'https://discord.com/api/oauth2/token', + required: true, + }, + { + displayName: 'Scope', + name: 'scope', + type: 'hidden' as NodePropertyTypes, + default: scopes.join(' '), + }, + // https://discordapi.com/permissions.html#104448 + { + displayName: 'Auth URI Query Parameters', + name: 'authQueryParameters', + type: 'hidden' as NodePropertyTypes, + default: 'permissions=104448', + }, + { + displayName: 'Authentication', + name: 'authentication', + type: 'hidden' as NodePropertyTypes, + default: 'header', + }, + ]; +}