question

Bcarbs avatar image
Bcarbs asked

Authorization code returns error : invalid_grant when requesting access and refresh tokens

Whenever I try to gain my bearer tokens with my newly acquired code I receive this error...

{"error_description":"The request has an invalid grant parameter : code","error":"invalid_grant"}

I'm attempting to gather these tokens immediately after receiving the code, it should be valid, I am constructing my request in this manner... (expired code and abbreviated secret)

https://api.amazon.com/auth/o2/token?grant_type=authorization_code&code=ANEZfezOoSgNCUrapNAD&client_id=amzn1.application-oa2-client.1d46c0b931e74813bda81d4e1c776b1c&client_secret=7c92e...a&redirect_uri=https%3A%2F%2Fwww.getpostman.com%2Foauth2%2Fcallback&code_verifier=test

Just to make sure my request structure is valid I tested the same process and successfully acquired access and refresh tokens for scope=profile utilizing the same app and formulated request like above (using the amazon profile endpoint). dash:replenish seems to be immediately rejecting these authorization_codes for some reason or there is a different actual error masked within the invalid_grant response?

login with amazondash replenishment service
10 |5000

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

1 Answer

Levon@Amazon avatar image
Levon@Amazon answered
10 |5000

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