2021-07-15 10:30:59 -07:00
|
|
|
import {
|
|
|
|
ICredentialType,
|
2021-10-07 14:07:56 -07:00
|
|
|
INodeProperties,
|
2021-07-15 10:30:59 -07:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class ServiceNowOAuth2Api implements ICredentialType {
|
|
|
|
name = 'serviceNowOAuth2Api';
|
|
|
|
extends = [
|
|
|
|
'oAuth2Api',
|
|
|
|
];
|
|
|
|
displayName = 'ServiceNow OAuth2 API';
|
|
|
|
documentationUrl = 'serviceNow';
|
2021-10-07 14:07:56 -07:00
|
|
|
properties: INodeProperties[] = [
|
2021-07-15 10:30:59 -07:00
|
|
|
{
|
|
|
|
displayName: 'Subdomain',
|
|
|
|
name: 'subdomain',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'string',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: '',
|
2022-04-02 08:22:13 -07:00
|
|
|
hint: 'The subdomain can be extracted from the URL. If the URL is: https://dev99890.service-now.com the subdomain is dev99890',
|
2021-07-15 10:30:59 -07:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Authorization URL',
|
|
|
|
name: 'authUrl',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'hidden',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: '=https://{{$self["subdomain"]}}.service-now.com/oauth_auth.do',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token URL',
|
|
|
|
name: 'accessTokenUrl',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'hidden',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: '=https://{{$self["subdomain"]}}.service-now.com/oauth_token.do',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'hidden',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: 'useraccount',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'hidden',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: 'response_type=code',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Auth URI Query Parameters',
|
|
|
|
name: 'authQueryParameters',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'hidden',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: 'grant_type=authorization_code',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Authentication',
|
|
|
|
name: 'authentication',
|
2021-10-07 14:07:56 -07:00
|
|
|
type: 'hidden',
|
2021-07-15 10:30:59 -07:00
|
|
|
default: 'header',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|