question

aurelianr1 avatar image
aurelianr1 asked

encounter 400 error when using amazon cloud rive rest api

Hello I make this request { https://www.amazon.com/ap/oa?client_id=amzn1.application-oa2-clientxxxxxxxxxxxxxxxxxxxxxxxxx&scope=clouddrive%3Aread%20clouddrive%3Awrite&response_type=code&redirect_uri=https://roscasend.go.ro:8443/ } and I am successfully redirected to this page { https://roscasend.go.ro:8443/?code=cccccccoooooodeeeeeee&scope=clouddrive%3Aread+clouddrive%3Awrite } But when update the fields from the following request { POST https://api.amazon.com/auth/o2/token HTTP/1.1 Host: api.amazon.com Content-Type: application/x-www-form-urlencoded Cache-Control: no-cache grant_type=authorization_code&code=cccccccoooooodeeeeeee&client_id=amzn1.application-oa2-clientxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=secret______________________&redirect_uri=http%3A%2F% 2Froscasend.go.ro%3A8443 } with my credentials I am encounter the 400 error. Would you give me any solution regarding how to update the above request in order to work? Best Regards, Aurelian
amazon drive
10 |5000

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

Joao Paulo Ferreira avatar image
Joao Paulo Ferreira answered
The 400 code is a generic one for Bad Request, but Amazon usually sends more information in the response itself. If the page in the uri_direct is one you own and can modify, you can try to add code to it to show the message that's sent in the response.
10 |5000

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

Jamie Grossman avatar image
Jamie Grossman answered
Hi there, Thanks for the post. We recently launched some granular scopes to choose when requesting access to customer accounts for reading content. Older apps created before this feature was implemented can still use the cloud drive:read scope whereas new app developers must use the new scopes. For more information, see here: https://developer.amazon.com/public/apis/experience/cloud-drive/content/getting-started Regards, Jamie
10 |5000

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

aurelianr1 avatar image
aurelianr1 answered
I whitelisted the following url : https://roscasend.go.ro/ and ì used for redirect_uri the following url https://roscasend.go.ro and for that reason I encountered the bad request error. I updated the redirect_uri to be the same as the allowed origin url from the web settings tab of the security profile and it worked.
10 |5000

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