2022-07-24 08:36:17 -07:00
|
|
|
import { ICredentialType, INodeProperties } from 'n8n-workflow';
|
2020-01-13 18:46:58 -08:00
|
|
|
|
|
|
|
export class GithubOAuth2Api implements ICredentialType {
|
|
|
|
name = 'githubOAuth2Api';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-24 08:36:17 -07:00
|
|
|
extends = ['oAuth2Api'];
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-05-24 02:36:19 -07:00
|
|
|
displayName = 'GitHub OAuth2 API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'github';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2022-06-13 22:27:19 -07:00
|
|
|
{
|
|
|
|
displayName: 'Grant Type',
|
|
|
|
name: 'grantType',
|
|
|
|
type: 'hidden',
|
|
|
|
default: 'authorizationCode',
|
|
|
|
},
|
2020-04-04 08:34:10 -07:00
|
|
|
{
|
|
|
|
displayName: 'Github Server',
|
|
|
|
name: 'server',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-04-04 08:34:10 -07:00
|
|
|
default: 'https://api.github.com',
|
2021-08-21 05:25:42 -07:00
|
|
|
description: 'The server to connect to. Only has to be set if Github Enterprise is used.',
|
2020-04-04 08:34:10 -07:00
|
|
|
},
|
2020-02-09 15:39:14 -08:00
|
|
|
{
|
|
|
|
displayName: 'Authorization URL',
|
|
|
|
name: 'authUrl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2022-07-24 08:36:17 -07:00
|
|
|
default:
|
|
|
|
'={{$self["server"] === "https://api.github.com" ? "https://github.com" : $self["server"]}}/login/oauth/authorize',
|
2020-02-09 15:39:14 -08:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token URL',
|
|
|
|
name: 'accessTokenUrl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2022-07-24 08:36:17 -07:00
|
|
|
default:
|
|
|
|
'={{$self["server"] === "https://api.github.com" ? "https://github.com" : $self["server"]}}/login/oauth/access_token',
|
2020-02-09 15:39:14 -08:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2022-07-24 08:36:17 -07:00
|
|
|
default:
|
2022-09-02 07:13:17 -07:00
|
|
|
'repo,admin:repo_hook,admin:org,admin:org_hook,gist,notifications,user,write:packages,read:packages,delete:packages,workflow',
|
2020-02-09 15:39:14 -08:00
|
|
|
},
|
2020-02-09 13:33:40 -08:00
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-02-09 13:33:40 -08:00
|
|
|
default: '',
|
|
|
|
},
|
2020-02-14 18:48:58 -08:00
|
|
|
{
|
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'hidden',
|
2020-02-14 18:48:58 -08:00
|
|
|
default: 'header',
|
|
|
|
},
|
2020-01-13 18:46:58 -08:00
|
|
|
];
|
|
|
|
}
|