tokens-api-2021-03-01
The Selling Partner API for Tokens provides a secure way to access a customer'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 calls to restricted operations that correspond to the restricted resources that you specified.
For more information, see the Tokens API Use Case Guide.
Installing
yarn add @sp-api-sdk/tokens-api-2021-03-01
npm install @sp-api-sdk/tokens-api-2021-03-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