Search code examples
amazon-clouddrive

how can I get Amazon Cloud Drive access token?


I am trying to get access token for amazon cloud drive. First I am requesting this url:

https://www.amazon.com/ap/oa?client_id=MYCLIENTID&scope=clouddrive%3Aread_all%20clouddrive%3Awrite&response_type=code&redirect_uri=https://mymusic.az/signin

Then I am clicking continue. After that I am redirecting this URL:

https://mymusic.az/signin?code=SOMECODE&scope=clouddrive%3Aread_all+clouddrive%3Awrite

I got SOMECODE from URL. But it is not access token? How can I get access token with SOMECODE?


Solution

  • It's really obvious what is happening if you read the documentation.

    There are two types of authorization, Implicit Grants which return an authorization token that will expire, and Authorization Code Grants which return an authorization code that doesn't expire. You are requesting an Authorization Code and that is what you are getting back. You then make another request using the authorization code whenever you need to retrieve an access token. At the very least I suggest reading the entire section of the documentation titled "Authorization Code Grant".