简体   繁体   中英

How to get Access token from Google Smart Home Action?

I'm using the Google Smart Home action and my skill is successfully linked. Getting a below SYNC intent.

{
    "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
    "inputs": [{
      "intent": "action.devices.SYNC"
    }]
}

But not getting the Authorization token to call the cloud api (As we getting in Alexa), So how can I get the Authorization token?

Google attach user's access token on Authorization header when call your fulfillment URL, as the following document Fulfillment and authentication :

When you have authenticated a user, the user's third-party OAuth 2 access token is sent in the Authorization header when smart home intents are sent to your fulfillment.

I was able to resolve it by checking the API Gateway logs, I was receiving the access token on api gateway but api gateway was sending only body part to the function not the header.

So what you need to do is just add the header manually in the request(for your function) and then you will surely receive that access token.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM