Initial import of verae-zapier-app from zapier monorepo
This commit is contained in:
commit
c19bccd652
16 changed files with 618 additions and 0 deletions
38
authentication.js
Normal file
38
authentication.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* 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}})',
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue