question

willy avatar image
willy asked

Why is my Lambda function not receiving Alexa.Authorization directive

I'm not receiving an authorization token. Even though I do get the discovery request when adding the device.


I created a smart home skill along with a lambda function on AWS with a working trigger. Account linking is done via AWS cognito.

When opening the skill and I link the account everything works correctly when I sign in.


However my lamda function is not receiving the authorization directive. And its not generating any logs on cloudwatch

Alexa.Authorization


I can confirm the lamda function + trigger is working correctly because when I scan for devices its receiving the following discoverey request.

{    "directive": {        "header": {            "namespace": "Alexa.Discovery",            "name": "Discover",            "payloadVersion": "3",            "messageId": "8d7d0461-686e-4b4c-9828-a4584f0da094"        },        "payload": {            "scope": {                "type": "BearerToken",                "token": "5654kb7kj5437kjl54"            }        }    } } 


I would like to send a doorbell request but need the access token.

Where am I going wrong ? I'm under the impression you are supposed to get the

Alexa.Authorization

message to lambda upon sussecfull account linking.


for testing I also tried this code in the index.js lambda function to try and catch the authorization request

exports.handler = function (request, context) {
log("DEBUG:", "Discover request",  JSON.stringify(request));

};



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.

1 Answer

Jason@Amazon avatar image
Jason@Amazon answered

You need to enable permissions for the skill that allow you to send proactive events for smart home skills - check out the documentation here for more details:

https://developer.amazon.com/docs/alexa/smarthome/authenticate-a-customer-permissions.html#steps-for-asynchronous-message-authentication

10 |5000

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