Reputation: 85
I have a Dialogflow fulfillment written in PHP. It was using v1 of the Dialogflow API and I'm migrating to v2.
I don't need users to authenticate when using the app, but I used User Entities in v1 and under v2 these require authentication using OAuth.
I'm working through the documentation here and having trouble with Step 1: Configure the client object.
Since I am halfway through executing PHP code in order to fulfill a request from the user, how should I set $client->setRedirectUri? I need to get authorisation for the next line of code to then make a call via the Dialogflow projects.agent.sessions.entityTypes.patch API call so not sure where I would be 'redirecting' when the authorisation response comes back.
Upvotes: 1
Views: 551
Reputation: 71
I had the same problem using Dialogflow library on NodeJs, here is what I did to solve the problem:
And thats all!
Upvotes: 2
Reputation: 50701
The authorization required here isn't authorization from the user to set a Session Entity - it is authorization of your server to make sure it is allowed to access the API at all. You will typically do this with a service account and keep the auth info tightly controlled. This is similar to the "API keys" that were used with V1, but is using a more standard auth method.
Upvotes: 1