Showing posts with label amazon oauth2 refresh token. Show all posts
Showing posts with label amazon oauth2 refresh token. Show all posts

Friday, December 23, 2022

Amazon API Generate Access Token and Refresh Token


a)  Log into Amazon Developer Console

https://developer.amazon.com/dashboard

b) Login with Amazon > Create a Security Profile

c) Generate client id and client secret.

d) Add redirect url under web settings as a whitelist redirect url.

e) Generate Authorization Code (One Time)

https://www.amazon.com/ap/oa?client_id=xxxxxxxxxxx&response_type=code&redirect_uri=http://localhost&scope=profile&state=SPECIAL

f) Generate Refresh Token (One Time)

curl --request POST --data "code=xxxxxxxxxxx&client_id=xxxxxxxxxxxx&client_secret=xxxxxxxxxxxxx&redirect_uri=http://localhost&grant_type=authorization_code" https://api.amazon.com/auth/o2/token

g) Generate Access Token from Refresh token (Always)

curl --request POST --data "client_id=xxxxxxxxxxx&client_secret=xxxxxxxxxxx&refresh_token=xxxxxxxxxxxxxxxxxxx&grant_type=refresh_token" https://api.amazon.com/auth/o2/token