tokens-api-2021-03-01
The Selling Partner API for Tokens provides a secure way to access a customers's PII (Personally Identifiable Information). You can call the Tokens API to get a Restricted Data Token (RDT) for one or more restricted resources that you specify. The RDT authorizes you to make subsequent requests to access these restricted resources.
Installing
yarn add @sp-api-sdk/aplus-content-api-2020-11-01
npm install @sp-api-sdk/aplus-content-api-2020-11-01
Getting Started
import {SellingPartnerApiAuth} from '@sp-api-sdk/auth'
import {TokensApiClient} from '@sp-api-sdk/tokens-api-2021-03-01'
const auth = new SellingPartnerApiAuth({
clientId: '',
clientSecret: '',
refreshToken: '',
secretAccessKey: '',
accessKeyId: '',
region: '',
role: {
arn: '',
}
})
const client = new TokensApiClient({
auth,
region: 'eu'
})
Handle Rate Limiting
If you want to let the SDK retry after each 429 responses, instanciate the client like this:
const client = new TokensApiClient({
auth,
region: 'eu',
rateLimiting: {
retry: true,
onRetry: (retryInfo) => console.log(retryInfo)
}
})
The SDK gets the rate limits for each routes from the API documentation
API documentation
See here