0
votes

I'm developing a new skill to Amazon Echo and I'm facing some problems when I need to get the clientContext to verify what is the Client ID of this Amazon Echo in the application.

Anyone know how it works correctly? Every time I receive undefined value in context.clientContext.

I made this process in Alexa developer panel:

1) Create a Skill as "Custom interaction Model"

2) Filled the Interaction Model correctly

3) Endpoint I linked with the Lambda Function

4) I've checked Yes to "Do you allow users to create an account or link to an existing account with you?" question.

In lambda function I made it:

1) Used example "Colors" of the Alexa in Lambda

2) In the first line, I put the log to verify what the information is arriving.

Like this:

console.log("event.session.application.applicationId=" + event.session.application.applicationId);
console.log('clientContext =', context.clientContext); 
console.log('context =', context);

The data is:

clientContext = undefined

{ callbackWaitsForEmptyEventLoop: [Getter/Setter], done: [Function], succeed: [Function], fail: [Function], logGroupName: '/aws/lambda/color', logStreamName: '2016/08/19/[$LATEST]7d66fec34f604692ad4c0bd1d138ae51', functionName: 'color', memoryLimitInMB: '128', functionVersion: '$LATEST', getRemainingTimeInMillis: [Function], invokeid: '14c606ef-6614-11e6-940d-cd0e175f3bda', awsRequestId: '14c606ef-6614-11e6-940d-cd0e175f3bda', invokedFunctionArn: 'arn:aws:lambda:us-east-1:...........86:function:color' }

I read in the Lambda documentation that it is possible for this value to be null, but what is the reason for this value to be null?

Thanks a lot.

1
why do you need to verify the client id? are you trying to verify who the linked user is?Jeremy
Yes. to verify who is linked.pedro.olimpio

1 Answers

2
votes

You can figure out who the linked user is by using the OAuth token that your server returned to Amazon upon account linkage.

In a skill, that token is passed to you, if it exists, by amazon in the session. Eg. In a javascript Lambda: session.user.accessToken