@ev1lc0rp/n8n-nodes-ninjaone
Version:
Professional NinjaOne RMM integration for n8n with complete ticketing and device management
81 lines • 3.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NinjaOneOAuth2Api = void 0;
class NinjaOneOAuth2Api {
constructor() {
this.name = 'ninjaOneOAuth2Api';
this.extends = ['oAuth2Api'];
this.displayName = 'NinjaOne OAuth2 API';
this.documentationUrl = 'https://app.ninjaone.com/apidocs-beta/authorization/flows/authorization-code-flow';
this.properties = [
{
displayName: 'Grant Type',
name: 'grantType',
type: 'options',
options: [
{
name: 'Authorization Code (User - Required for Ticket Writes)',
value: 'authorizationCode',
},
{
name: 'Client Credentials (Machine-to-Machine - Read/Devices Only)',
value: 'clientCredentials',
},
],
default: 'authorizationCode',
description: 'NinjaOne requires the Authorization Code flow to create/update tickets and add comments. Client Credentials cannot mutate tickets (the API returns HTTP 405).',
},
{
displayName: 'Base URL',
name: 'baseUrl',
type: 'string',
default: 'https://app.ninjaone.com',
required: true,
description: 'Regional host of your NinjaOne instance, with no trailing slash (e.g. https://app.ninjaone.com, https://eu.ninjaone.com, https://oc.ninjaone.com, https://us2.ninjaone.com). Use the same host you log in to the dashboard with.',
},
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'string',
default: 'https://app.ninjaone.com/ws/oauth/authorize',
required: true,
displayOptions: {
show: {
grantType: ['authorizationCode'],
},
},
description: 'OAuth2 authorize endpoint. Must be on the SAME regional host as the Base URL. Only used by the Authorization Code flow.',
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'string',
default: 'https://app.ninjaone.com/ws/oauth/token',
required: true,
description: 'OAuth2 token endpoint. Must be on the SAME regional host as the Base URL (e.g. https://eu.ninjaone.com/ws/oauth/token for the EU region).',
},
{
displayName: 'Scope',
name: 'scope',
type: 'string',
default: 'monitoring management offline_access',
description: 'Space-separated list of scopes. "monitoring" = read-only, "management" = create/update tickets, devices and organizations. Add "offline_access" so the Authorization Code flow can refresh the token.',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
default: 'body',
},
];
this.test = {
request: {
baseURL: '={{$credentials.baseUrl}}',
url: '/v2/organizations',
method: 'GET',
},
};
}
}
exports.NinjaOneOAuth2Api = NinjaOneOAuth2Api;
//# sourceMappingURL=NinjaOneOAuth2Api.credentials.js.map