alexa-smarthome
alexa-smarthome copied to clipboard
Unable to get Access token using authorization code for a skill in lambda function
Hi,
I have successfully enabled send alexa event permission and got client_id and secret.
I had received an authgrant request which contains an authorization code for my lambda function. from there I'm trying to get an access token using https://api.amazon.com/auth/o2/token
Getting below error
"statusCode": 500,
"body": {},
"headers": {
"server": "Server",
"date": "Fri, 20 Nov 2020 03:37:03 GMT",
"content-type": "application/json;charset=UTF-8",
"content-length": "2",
"connection": "close",
"x-amz-rid": "REBDS5MD3K1X1F6TPTC3",
"x-amzn-requestid": "24855146-25ed-4e0a-8393-8802e776bc88",
"x-amz-date": "Fri, 20 Nov 2020 03:37:03 GMT",
"x-amzn-errortype": "InternalFailure:http://internal.amazon.com/coral/com.amazon.coral.service/",
"cache-control": "no-cache, no-store, must-revalidate",
"pragma": "no-cache",
"vary": "Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "api.amazon.com",
"port": 443,
"hostname": "api.amazon.com",
"hash": null,
"search": "?grant_type=authorization_code&code=RHpeYchXfMSMpbUJJYSR&client_id=amzn1.application-oa2-client.40acc86a12a2448cbe29311c6045f3ca&client_secret=d8c4e2befa71b255c7dae925bf7a4a150f767600cd6ce6de29cbd955ba2274ac",
"query": "grant_type=authorization_code&code=RHpeYchXfMSMpbUJJYSR&client_id=amzn1.application-oa2-client.40acc86a12a2448cbe29311c6045f3ca&client_secret=d8c4e2befa71b255c7dae925bf7a4a150f767600cd6ce6de29cbd955ba2274ac",
"pathname": "/auth/o2/token",
"path": "/auth/o2/token?grant_type=authorization_code&code=RHpeYchXfMSMpbUJJYSR&client_id=amzn1.application-oa2-client.40acc86a12a2448cbe29311c6045f3ca&client_secret=d8c4e2befa71b255c7dae925bf7a4a150f767600cd6ce6de29cbd955ba2274ac",
"href": "https://api.amazon.com/auth/o2/token?grant_type=authorization_code&code=RHpeYchXfMSMpbUJJYSR&client_id=amzn1.application-oa2-client.40acc86a12a2448cbe29311c6045f3ca&client_secret=d8c4e2befa71b255c7dae925bf7a4a150f767600cd6ce6de29cbd955ba2274ac"
},
"method": "POST",
"headers": {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
"accept": "application/json",
"content-length": 0
}
}
}
while referring amazon documentation when we enable send alexa permission a security profile will be created in developer console but, I'm not able to see in my console Reference: https://developer.amazon.com/en-US/docs/alexa/smarthome/authenticate-a-customer-permissions.html Is there any change in the process?
@deekshith-elear Any update on how you resolved this?
Hi, do you have any updates on solving this? I am having the same problem recently. I have enabled the push event permission and do not see any change in the security profile. I send the code to the amazon token endpoint and keep receiving 500 response.
If you have difficulty retrieving accessToken and refreshToken, please use https://alexa.design/contactus for help.
Please do not share your client secret to public.