mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
59 lines
1.2 KiB
TypeScript
59 lines
1.2 KiB
TypeScript
import {
|
|
ICredentialType,
|
|
NodePropertyTypes,
|
|
} from 'n8n-workflow';
|
|
|
|
const scopes = [
|
|
'bot',
|
|
'connections',
|
|
'email',
|
|
'guilds',
|
|
'identify',
|
|
'messages.read',
|
|
'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=104600',
|
|
},
|
|
{
|
|
displayName: 'Authentication',
|
|
name: 'authentication',
|
|
type: 'hidden' as NodePropertyTypes,
|
|
default: 'header',
|
|
},
|
|
];
|
|
}
|