需要帮助以zapier CLI添加自定义身份验证

时间:2019-06-13 14:41:04

标签: zapier zapier-cli

我正在尝试向我的Zapier应用添加身份验证。我已经为在我的应用程序中添加新配置文件的时间设置了触发器,并在末端配置了django rest钩子并成功订阅了该钩子。我的问题是自定义身份验证。使用zapier应用程序时,我想输入一个密钥,令牌和事件ID来连接一个帐户。当我在进行快速切换时输入这些内容时,它会一直循环播放,然后说验证失败。

// authentication.js

const testCred = (z , bundle) => {
    return z.request({
        method: 'GET',
        url: 'http://192.168.0.14:8000/api/auth/',
        params: {
            key : bundle.authData.key,
            token : bundle.authData.token,
            event : bundle.authData.event 
        },
    }).then((response) => {
        if (response.status === 401) {
            throw new Error('The API Key you supplied is invalid');
        }
        return response.json;
    });
};

module.exports = {
    type: 'custom',

    fields: [
        { key: 'key', label: 'Key', required: true, type: 'text'},
        { key: 'token', label: 'Token', required: true, type: 'text' },
        { key: 'event', label: 'Event', required: true, type: 'text' }
    ],

    test: testCred,
    connectionLabel: 'testAuth connectionLabel'
};

运行zapier测试时,出现以下两个错误:

  1. TypeError: Cannot read property 'should' of undefined
  2. 我收到一个错误,表明请求未成功。当我尝试在邮递员中将参数作为JSON发送时,会遇到相同的错误。该错误证明该请求有效,但是如何将它们作为参数而不是json发送?

0 个答案:

没有答案
相关问题