1

Issue: Google actions builder fulfillment does not seem to send user access token in requests

Description: I'm migrating a bot from dialogflow assistant integration to actions builder (https://codelabs.developers.google.com/codelabs/actions-1/#0). Since I need user information to process requests, I'll be using account linking with oauth auth code flow. Since I've already built a bot with the dialogflow-google assistant integration, I have a Auth server running without any issues.

The problem seems to be with just google actions, even after the user account is linked looks like the actions fulfillment requests isn't sending user access tokens.

Web request sent by google actions:

{
    "handler": {
        "name": "StatusKey"
    },
    "intent": {
        "name": "StatusKeys",
        "params": {},
        "query": "Status of keys"
    },
    "scene": {
        "name": "StatusKeys",
        "slotFillingStatus": "UNSPECIFIED",
        "slots": {}
    },
    "session": {
        "id": "ABwppHHPFyRT9H389dscBq5wk9Pg8qbaBzYtN2nEmxXHdss_cwD9IIjfV447cq6A3oFFKE8DgeOdIA",
        "params": {},
        "typeOverrides": [],
        "languageCode": ""
    },
    "user": {
        "locale": "en-US",
        "params": {},
        "accountLinkingStatus": "LINKED",
        "verificationStatus": "VERIFIED",
        "packageEntitlements": [],
        "lastSeenTime": "2020-09-10T01:57:46Z"
    },
    "home": {
        "params": {}
    },
    "device": {
        "capabilities": [
            "SPEECH",
            "RICH_RESPONSE",
            "WEB_LINK",
            "LONG_FORM_AUDIO"
        ]
    }
}

User account linked

I also checked if the token endpoint is returning all the required tokens for google to access. Attached a sample response of it.

{
    "id_token": "****************************",
    "access_token": "**************************",
    "expires_in": 3600,
    "token_type": "Bearer",
    "refresh_token": "**************************",
    "scope": "openid Api offline_access"
}

The strange part is that the same set up works fine in the dialogflow-google assistant integration sending user access token in the fulfillment requests.

I've followed the steps from the attached article: https://developers.google.com/assistant/identity/oauth2?oauth=code

eglease
  • 2,445
  • 11
  • 18
  • 28

2 Answers2

1

In my case I can't find accesstoken in header or request body, account linking done successfully but token is not attached to header or request body .

0

Looks like the token gets passed in the request header. Closing the question!

  • Which request header? I seem to be in exactly the same situation and have studied the headers and can't find the oauth access token anywhere. – ijmacd Oct 22 '20 at 07:04
  • It turns out the access_token was in the HTTP Authorization header as others had mentioned in other threads. I couldn't see it in PHP because Apache had stripped it away. Adding `SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1` to `.htaccess` solved the problem. – ijmacd Jun 06 '22 at 11:25