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

Can't find user access token in requests to fulfilment webhooks #431

Open philipstratford opened 2 years ago

philipstratford commented 2 years ago

As per this issue, even after completing the account linking OAuth flow and seemingly successfully linking the user's Google account to their account in my own authentication system, I can't find the user's access token in requests coming from Conversational Actions to my fulfilment webhooks.

I'm testing with the simulator in the Actions Console so I'm able to view the body of the incoming requests. I'm assuming that my account has been successfully linked because I'm able to unlink it: google1

However, the user property of the request does not contain any property named accessToken: google2

Note also that in that second screenshot the user.accountLinkingStatus is "LINKED", cementing my belief that the accounts were linked successfully.

There is that params.bearerToken property which briefly got me excited, but its value doesn't match any tokens issued by my OAuth server. Since I can't find this property documented anywhere I don't know if it's supposed to contain the access token produced by my OAuth server, but whether it should or shouldn't, it doesn't!

Does the absence of an accessToken property indicate that something has gone wrong with my account linking process? If so, how might I go about figuring out what, since by all appearances it has worked? Or, should I be looking elsewhere for the access token?

dominik-meissner commented 2 years ago

Hi Philip,

the authorization property is in the header (not as you suspect in the body). I made the same mistake before :-)