如何在Webhook上使用Intuit Webhook验证程序令牌

时间:2020-08-02 13:56:53

标签: ruby-on-rails intuit

我已经使用intuit开发人员帐户创建了一个Webhook https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks#configuring-webhooks

工作正常,我的问题是如何使用验证程序令牌来保护Webhook?

我看到了各种各样的intuit标头,但不确定如何使用

headers

1 个答案:

答案 0 :(得分:0)

有详细的文档

  1. 使用您的验证者令牌作为密钥,用HMAC_SHA256_ALGORITHM哈希通知负载。
  2. 将intuit-signature标头从base-64转换为base-16。
  3. 将步骤1中的值与通知中的intuit-Signature标头进行比较。这些值应该相同。

https://developer.intuit.com/app/developer/qbo/docs/develop/webhooks/managing-webhooks-notifications#validating-the-notification

有关如何生成HMAC哈希(Using HMAC SHA256 in Ruby)以及如何将base64签名转换为base16(Converting a hexadecimal digest to base64 in Ruby)的更多信息。为了比较值,Rails确实实现了safe_compare方法(https://api.rubyonrails.org/classes/ActiveSupport/SecurityUtils.html)。