actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 197 forks source link

Google action dialogflow fullfilment webhook call accessToken is not present in request headers #394

Closed amiya-elear closed 4 years ago

amiya-elear commented 4 years ago

Hi Team, I have created an action on dialogflow then integrated my custom auth for account linking, I have hosted my own nodejs app and integrated with fulfillment webhook. my app is working as expected but when I print the of request body and the request headers for each webhook call I am not able to see access token field inside request headers section my accessToken is only present in "req.body.originalDetectIntentRequest.payload.user.accessToken". is it default behavior of every webhook call that accessToken only present in req.body not in req.headers section?, if not how can I have accessToken field inside the req.headers section?.

Fleker commented 4 years ago

The authentication access token is sent in the body, not in the header. Sending in the header is not something that is supported.

amiya-elear commented 4 years ago

Thanks fleker for your response, But I read one official document it says that "user's third-party OAuth 2 accessToken is sent in the Authorization header when smart home intents are sent to your fulfillment". my question is there any way to get accessToken in request headers or any configuration to send it in the request headers? official Doc: https://developers.google.com/assistant/smarthome/concepts/fulfillment-authentication

Fleker commented 4 years ago

This is true for smart home Actions, but different for conversational Actions.

amiya-elear commented 4 years ago

Thanks Fleker. yes I am creating a smart home action only but not getting accessToken in request headers. can you please share some example or docs so that I can implement.

Fleker commented 4 years ago

If you're using Dialogflow, you wouldn't be building a smart home action.