验证Hawk验证标头

时间:2019-02-22 11:49:09

标签: node.js

我正在通过第三方API构建Webhook接收器。标头是使用Hawk认证方案创建的,但是由于在调用hawk.server.authenticate时生成的Mac与标头中的Mac生成的Mac不同,因此我无法对其进行身份验证/验证。

 console.log('inside the auth', request.connection.info, '\n ');
    const credentialsFunc = id => ({
      key: '42343b342704cbbeb5fdfsfd244234423477d39a64cb228df8666edaad1fb91',
      user: id,
      algorithm: 'sha256'
    });

    try {
      const res = await Hawk.server.authenticate(request, credentialsFunc);
      console.log('res=====>\n', res);
    } catch (err) {
      console.log(err.message);
    }

这是它的结构方式,但始终会返回Bad Mac错误。

0 个答案:

没有答案