對話動作已於 2023 年 6 月 13 日淘汰。詳情請參閱「
對話動作已淘汰」。
驗證要求
系統會使用授權權杖簽署對對話式 Webhook 的要求
,並採用以下格式:
google-assistant-signature: "<JWT token>"
驗證權杖符合 JSON Web Token 格式,
其中目標對象欄位值等於 Actions 主控台的專案 ID
應用程式如要驗證簽章,請解壓縮權杖,並確認目標對象欄位
與應用程式的專案 ID 相符。您可以使用與 JWT 相容的組合來進行這項作業
憑證程式庫,例如 Google API Node.js 用戶端
或直接使用 Actions on Google Node.js 用戶端程式庫
ConversationOptions#verification
選項,如以下程式碼片段所示:
const {conversation} = require('@assistant/conversation');
const app = conversation({verification: 'nodejs-cloud-test-project-1234'});
// HTTP Code 403 will be thrown by default on verification error per request.
JWT 格式應為:
{
"iss": "https://accounts.google.com"
"aud": [project-id],
"nbf": number,
"iat": number,
"exp": number,
"jti": string
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-10-15 (世界標準時間)。
[null,null,["上次更新時間:2024-10-15 (世界標準時間)。"],[[["Conversational webhook requests include an authorization token in the `google-assistant-signature` header for security purposes."],["This token is a JSON Web Token (JWT) containing an audience field that matches your Actions console project ID, enabling verification."],["You can verify the signature using a JWT library or the `ConversationOptions#verification` setting within the Actions on Google Node.js Client Library."],["The JWT structure includes standard fields like issuer, audience, issue and expiration timestamps, and a unique identifier."]]],[]]