Google Actions not passing user info (access token/ identity token) in fulfillment request

321 Views Asked by At

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

2

There are 2 best solutions below

2
On

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

0
On

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 .