n8n/packages/nodes-base/credentials/DiscordOAuth2Api.credentials.ts

57 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-03-04 11:28:25 -08:00
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',
},
];
}