Weryfikowanie żądań (Dialogflow)
Żądania wysyłane do webhooka konwersacyjnego są podpisane tokenem autoryzacji
w nagłówku w takim formacie:
authorization: "<JWT token>"
Token uwierzytelniania jest zgodny z formatem tokena internetowego JSON,
gdzie wartość pola odbiorców jest równa identyfikatorowi projektu w Konsoli Actions dla:
aplikację. Aby zweryfikować podpis, rozpakuj token i sprawdź, czy pole odbiorców
pasuje do identyfikatora projektu danej aplikacji. Możesz to zrobić za pomocą tokena zgodnego z JWT
z biblioteki danych logowania, takiej jak klient Node.js interfejsów API Google,
lub bezpośrednio przy użyciu biblioteki klienta 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.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-10-15 UTC.
[null,null,["Ostatnia aktualizacja: 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"]]