master-zapier-plan-draft/packages/verae-zapier/authentication.js
George Lambert b4150c8250 Milestone 0: import zappier billing, Verae middleware, and Zapier research
Compose-ready workspace: packages/zappier (rate card, portal, Stripe),
packages/verae-zapier-middleware (timestamp + NATS), packages/verae-zapier
(CLI app), vendor/zapier-platform, and research/zapier vendor corpus.

Gate 0 structure checks pass. Product code and research are not yet wired.
2026-09-09 02:37:36 -04:00

38 lines
836 B
JavaScript

/**
* Custom API key auth against Verae middleware.
* @module authentication
*/
const middlewareBase = () =>
process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
/**
* Zapier connection test — validates API key.
* @param {object} z
* @param {object} bundle
*/
const testAuth = async (z, bundle) => {
const response = await z.request({
url: `${middlewareBase()}/zapier/v1/auth/me`,
headers: {
Authorization: `Bearer ${bundle.authData.api_key}`,
},
});
return response.data;
};
module.exports = {
type: 'custom',
fields: [
{
key: 'api_key',
type: 'string',
required: true,
label: 'API Key',
helpText:
'Your Verae API key (zmw_…) from signup or admin provisioning.',
},
],
test: testAuth,
connectionLabel: '{{tenantId}} ({{plan}})',
};