傳送至對話 Webhook 的要求會以標頭中的授權權杖簽署,格式如下:
authorization: "<JWT token>"
驗證權杖符合 JSON Web Token 格式,其中目標對象欄位值與應用程式的 Actions Console 專案 ID 相同。如要驗證簽章,請解密權杖,並確認目標對象欄位與應用程式的專案 ID 相符。如要利用 JWT 相容的憑證程式庫 (例如 Google API Node.js 用戶端) 或直接使用 Actions on Google Node.js 選項ActionsSdkOptions#verification
,
const {actionssdk} = require('actions-on-google'); const app = actionssdk({verification: 'nodejs-cloud-test-project-1234'}); // HTTP Code 403 will be thrown by default on verification error per request.