Generate Access Tokens SP API Amazon

Ghayoor Haider
3 min readJul 20, 2023

--

When interacting with the Selling Partner API, regardless of whether you are utilizing Postman or any other development language, the process typically involves Access Token.

If you are calling API that has Grantless access You need to Generate Access Tokens for Grantless Operations. The main difference is that you don’t need a refresh token, but you have to specify the scope (the access level) for the API you want to use with that token.

Generate a Login with Amazon (LWA) access token: Authorize your application to access selling data on behalf of a selling partner. After the access token is issued, it can be used for multiple SP-API calls until it expires.

To make SP-API calls, you need Self-authorization or a third-party OAuth workflow.

Credentials required to Access Token

  1. Aws_access_key_id and Aws_sceret_access_key You will get these keys while creating Iam User and Iam Role.
  2. client_id and client_secret You get these credentials after you register your application on Seller Central.
  3. LWA refresh_token You get your LWA refresh token from Seller Central after Authorizing Your Application.
  4. SP-API endpoint and AWS Region. Refer to SP-API Endpoints for more information.

Generate a Login with Amazon (LWA) access token using Postman

Open Postman and sign in to your account.

  • For Workspaces, choose your workspace.
  • Choose New.
  • On the Create New dialog box, choose HTTP Request.
HTTP Request.
  • For Request, choose POST.
Choose POST
  • Copy and paste the following link into the text box
https://api.amazon.com/auth/o2/token
Paste the link
  • Choose the Authorization tab and for Type, choose No Auth.
Choose No Auth
  • Choose the Body tab, and select x-www-form-urlencoded.
  • In the Body table, add the following key-value pairs
  • Choose Send.

The response returns the access token that you use to authenticate to SP-API.

"access_token": "Atza|*****",
"refresh_token": "Atzr|*****"'
"token_type": "bearer",
"expires_in": 3600
  • For Grantless Operations
    In the Body table, add the following key-value pairs
  • Choose Send.

The response returns the grantless access token that you use to authenticate to SP-API.

{
"access_token": "Atc|*****",
"scope": "sellingpartnerapi::*****",
"token_type": "bearer",
"expires_in": 3600
}

Stay Tuned For More.

--

--