zapier-app/authentication.js
2026-11-28 15:28:03 +02:00

28 lines
846 B
JavaScript

'use strict';
const config = require('./lib/config');
const { api } = require('./lib/http');
// Checks the key with GET /v1/token, which any valid key can call. The key itself is never returned.
const test = (z) => api(z, { path: '/v1/token' });
module.exports = {
type: 'custom',
fields: [
{
key: 'apiKey',
label: 'API Key',
type: 'password',
required: true,
helpText:
'Create a key in the [API Center](' + config.API_CENTER_URL + ') of ' + config.PANEL_NAME +
', with the permissions your Zaps need. A `sandbox_` key simulates every change, so you can try your Zaps safely.',
},
],
test,
connectionLabel: (z, bundle) => {
const d = bundle.inputData || {};
const name = d.name ? String(d.name) : 'API key';
return d.mode ? name + ' (' + d.mode + ')' : name;
},
};