I might be missing this entirely in the documentation, but I'm looking for examples of passing authentication to and from Dialogflow.
The Dialogflow examples I find are open for all users, but I want the Dialogflow interaction to be logged into a specific authenticated user. I setup Google Cloud Identity and Firestore Auth, but I can not find good examples of how to move that authentication information securely through Dialogflow in its requests to the Firestore database. I am using NodeJS on the backend webhooks.
There's no straight-forward option to authenticate a user for Dialogflow fulfillment. A suggestion to handle how to pass credentials and the webhook connection is as follows:
payload
field in the QueryParameters object in the detectIntent request to pass the necessary information to validate the user during the fulfillmentpayload
data in the webhook request to authenticate the userEDIT
When using Dialogflow-Messenger, you don't have access to the Dialogflow API directly; however, for the step 3, you can still pass a value to queryParams.payload
through the user-id
HTML customization.
Here's an example of how to set it dynamically:
const dfMessenger = document.querySelector('df-messenger');
dfMessenger.setAttribute("user-id", YOUR_USER); // Sent to Dialogflow API through queryParams.payload