2020-01-01 22:51:23 -08:00
|
|
|
import {
|
2020-01-07 16:29:11 -08:00
|
|
|
ICredentialType,
|
2021-06-12 09:39:55 -07:00
|
|
|
INodeProperties,
|
2020-01-01 22:51:23 -08:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
|
|
|
|
export class OAuth2Api implements ICredentialType {
|
2020-01-07 16:29:11 -08:00
|
|
|
name = 'oAuth2Api';
|
|
|
|
displayName = 'OAuth2 API';
|
2020-08-17 05:42:09 -07:00
|
|
|
documentationUrl = 'httpRequest';
|
2022-05-24 02:36:19 -07:00
|
|
|
genericAuth = true;
|
2021-06-12 09:39:55 -07:00
|
|
|
properties: INodeProperties[] = [
|
2020-01-07 16:29:11 -08:00
|
|
|
{
|
|
|
|
displayName: 'Authorization URL',
|
|
|
|
name: 'authUrl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-01-07 16:29:11 -08:00
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token URL',
|
|
|
|
name: 'accessTokenUrl',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-01-07 16:29:11 -08:00
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Client ID',
|
|
|
|
name: 'clientId',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-01-07 16:29:11 -08:00
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Client Secret',
|
|
|
|
name: 'clientSecret',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-01-07 16:29:11 -08:00
|
|
|
typeOptions: {
|
|
|
|
password: true,
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-01-07 16:29:11 -08:00
|
|
|
default: '',
|
|
|
|
},
|
2020-02-08 16:14:28 -08:00
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'string',
|
2020-02-08 16:14:28 -08:00
|
|
|
default: '',
|
2022-04-13 23:32:27 -07:00
|
|
|
description: 'For some services additional query parameters have to be set which can be defined here',
|
2020-02-08 16:14:28 -08:00
|
|
|
placeholder: 'access_type=offline',
|
|
|
|
},
|
2020-02-14 18:48:58 -08:00
|
|
|
{
|
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
2021-06-12 09:39:55 -07:00
|
|
|
type: 'options',
|
2020-02-14 18:48:58 -08:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Body',
|
|
|
|
value: 'body',
|
|
|
|
description: 'Send credentials in body',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Header',
|
|
|
|
value: 'header',
|
|
|
|
description: 'Send credentials as Basic Auth header',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'header',
|
|
|
|
},
|
2020-01-07 16:29:11 -08:00
|
|
|
];
|
2020-01-01 22:51:23 -08:00
|
|
|
}
|