question

Andreas Richiger avatar image
Andreas Richiger asked

Why I'm getting: "The access token does not have sufficient permission(s) to authorize the request." from the alexa event gateway?

I'm migrating my smart home skill from v2 to v3.

In developer console I pressed "go to development" on my skill. Enabled payload V3 and checked "Send Alexa Events" on the configuration page.

I migrated the lambda function an my code.

Now, when I relink the development skill the AccessGrant directive gets executed and works fine. It's getting the authorization code. Then authorization code is used to retrieve access token and refresh token. Everything is fine.

Discovery works fine and all devices show up in the alexa app. The flags "Retrievable" and "ProactivelyReported" are set to true for all objects.

When I click on a device in the alexa app, for instance a switchable light (power_controller) the correct state is shown in the alexa app and I'm able to change the state.

According to the flag "ProactivelyReported" my code sends a change report to https://api.eu.amazonalexa.com/v3/events. The Alexa Event Gateway responds with the error message:

{

"error":"insufficient_permission",

"error_description":"The access token does not have sufficient permission(s) to authorize the request."

}

Unfortunately I can't find out where to configure the permission.

alexa smart home
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andreas Richiger avatar image
Andreas Richiger answered

Found part of the problem. I mixed up the access-token-from-skill and the access-token-from-amazon. Refer to SmartHomeSkillAPI: handleControl directive token Vs event token

Now my changeReport is accepted by the alexa event gateway (http respose.status = accepted). But the icon in the alexa app is not updated. The changeReport has no effect.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tsuneki@Amazon avatar image
Tsuneki@Amazon answered

Hi there,

Thanks for posting.

It is good to hear you solved part of the problem.

We are currently investigating the icon issue.

In the meantime, could you provide your skill ID for further investigation?

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andreas Richiger avatar image Andreas Richiger commented ·

Hallo Tsuneki,

Thanks for your support. The Skill ID is: amzn1.ask.skill.cbc432bb-44a7-4a12-9d5b-249b054e82f2

The is a certified version of the myHomeControl skill. Actually am working on the development version to migrate from V2 to V3.

The test system is up and running. Feel free to execute commands. Refer to "Esstischleuchte"(switchable light) and "Bad"(dimmable light), which are working properly and will send events to the alexa gateway.

Originally I tought to respond to directives, which change a state of a smart home device, with a "DefferedResponse" and sending the actual state as event to the alexa gateway. But as this didn't update the icon in the alexa app, the skill is now responding to the directive with a stateReportResponse and in parallel it sends a changeReport to the alexa event gateway.

Regards, Andi

0 Likes 0 ·
Tsuneki@Amazon avatar image Tsuneki@Amazon ♦ Andreas Richiger commented ·

Hi Andy,

My apologies for delayed response.

Alexa may rely on a combination of skill queries (sending ReportState directives) and proactive state updates (ChangeReport events from the skill) to help ensure that customers receive accurate device information in the Alexa app. We may rely on both ReportState and ChangeReport information until there is high confidence that the ChangeReport data is accurate, at which time your skill may receive fewer queries.

Please refer to the document here for details.

I hope this will help you

Best,

Tsuneki

0 Likes 0 ·