Xác minh yêu cầu (Dialogflow)
Các yêu cầu gửi đến webhook trò chuyện của bạn được ký bằng mã thông báo uỷ quyền trong tiêu đề, theo định dạng sau:
authorization: "<JWT token>"
Mã thông báo xác thực tuân theo định dạng Mã thông báo web JSON,
trong đó giá trị trường đối tượng bằng với mã dự án Actions Console
ứng dụng. Để xác minh chữ ký, hãy giải nén mã thông báo và đảm bảo trường đối tượng
khớp với mã dự án của ứng dụng. Bạn có thể thực hiện việc này bằng cách tương thích với JWT
thư viện thông tin xác thực, chẳng hạn như ứng dụng Node.js cho API của Google,
hoặc trực tiếp sử dụng Thư viện ứng dụng Node.js cho Actions on Google
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.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-10-15 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2024-10-15 UTC."],[[["Conversational webhook requests are signed with a JWT token in the authorization header for security."],["The JWT token's audience field should match your Actions Console project ID for verification."],["You can verify the token using JWT libraries or the Actions on Google Node.js Client Library's built-in verification option."]]],["Requests include an authorization header with a JSON Web Token (JWT). The token's audience field must match the Actions Console project ID. Verify the token's signature using a JWT library or the `ActionsSdkOptions#verification` option in the Actions on Google Node.js Client Library. This can be set using the `actionssdk` method with the project ID. Failure to verify will result in a HTTP 403 error.\n"]]