question

newuser-31271531-a381-446e-b971-054846e6be92 avatar image
newuser-31271531-a381-446e-b971-054846e6be92 asked ·

400 response on requesting access token for scope proactive events

I have been trying to get an access token so I can send a proactive event. But I been receiving status code 400.

Following is my request:

host: api.amazon.com 
port: 443
path: /auth/O2/token
method: POST 

request body parameters:

grant_type=client_credentials&client_id={clientId}&client_secret={secret}&scope=alexa::proactive_events 

Header:

Content-Type: application/x-www-form-urlencoded 


It says the scope is invalid.

{
    "error_description": "The request has an invalid parameter : scope",
    "error": "invalid_scope

I have tried this multiple times and every time I have received 500. Is there anything that I am doing wrong?

@Anand@Amazon

alexa skills kitnotificationsproactive events
10 |2000 characters needed characters left characters exceeded

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

Anand@Amazon avatar image
Anand@Amazon answered ·

Hello there,

You are getting 500 error because endpoint is not right.

host: api.amazon.com 
port: 443
path: /auth/o2/token  //// It's small "o" (oh) not zero
method: POST


4 comments
10 |2000 characters needed characters left characters exceeded

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

Anand@Amazon avatar image Anand@Amazon ♦ newuser-31271531-a381-446e-b971-054846e6be92 ·

How do you get client ID and client secret?

To fix this deploy your skill with notification permission "alexa::devices:all:notifications:write". Once it deployed go to permission section and then you will find client Id and secret which you need to pass to generate access token.

You can also run the command ask api get-skill-credentials -s {skill-id} but make sure you have deployed your skill with a manifest that has Notifications permissions enabled

Check this link to know more.

2 Likes 2 ·

Yes, that's it...you need to add the permission to the skill manifest first using the ASK CLI. Only then you can get the ID and Secret to get the token.

I learned it this week!

0 Likes 0 ·
Show more comments
newuser-31271531-a381-446e-b971-054846e6be92 avatar image
newuser-31271531-a381-446e-b971-054846e6be92 answered ·
10 |2000 characters needed characters left characters exceeded

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

newuser-31271531-a381-446e-b971-054846e6be92 avatar image
newuser-31271531-a381-446e-b971-054846e6be92 answered ·
10 |2000 characters needed characters left characters exceeded

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

ham avatar image
ham answered ·

I ran into this issue, trying to login to access token API, the step I missed was not attaching the security profile created under the API access. The 2nd step from this article:
API Access | App Submission and Testing (amazon.com)

10 |2000 characters needed characters left characters exceeded

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