Comments (3)
Hi!
I can reproduce your error and I think I found the issue. We missed the different way of requesting an access token for grantless operations as stated here in the docs.
We have to change grant_type to "client_credentials" and use "scope" instead of "refresh_token" for all grantless operations. Its a bit complicated as we would basically have to have two different access tokens depending on the operation and as a result also two token refresh calls.
We will think about whats the best solution and will come up with a fix. For the time being you could make it work by just copying the "refreshAccessToken" function in the SellingPartner.js, rename to lets say "refreshGrantlessAccessToken" and just change the body of the request to the following:
body:JSON.stringify({
grant_type:'client_credentials',
scope:'sellingpartnerapi::notifications',
client_id:this._credentials.app_client.id,
client_secret:this._credentials.app_client.secret
})
If you then replace the await sp.refreshAccessToken
in your code with await sp.refreshGrantlessAccessToken
the call to getDestinations should work.
from amazon-sp-api.
Thanks, it works
from amazon-sp-api.
Just uploaded a new version (0.3.3) that includes support for grantless operations. Looking at your example you could now just add the scope of the grantless operation to the refresh like this:
await sp.refreshAccessToken('sellingpartnerapi::notifications')
Alternatively as it seems you didn't change the "auto_request_tokens" option (which is true by default) you could also just skip refreshAccessToken and refreshRoleCredentials calls as this will be done automatically by the client.
More information on the topic can be found in the Readme.
from amazon-sp-api.
Related Issues (20)
- fulfillmentOutbound / createFulfillmentOrder / destinationAddress does not accept DC as a valid stateOrRegion
- Inventory stock update HOT 3
- Issue of "Access to requested resource is denied." HOT 16
- TS exception HOT 1
- missing productPricing.getCompetitiveSummary from 2022-05-01 version HOT 4
- How can I best get the requestID and timestamp for SP-API support? HOT 1
- getFeed
- Add ability to add error handling middleware HOT 1
- Gracefully handle timeouts HOT 4
- [Bug]`orders.confirmShipment` error on parsing body response
- QueryType = "NEXT_TOKEN" perhaps not being sent to getShipmentItemsByShipmentId?
- Missing timeouts property in DownloadOptions interface HOT 1
- Need order info, tracking number and invoice data
- Is there a way to tell if a seller owns an ASIN or if the seller is a reseller?
- Credentials variables HOT 2
- Incorrect Header Check error downloading file HOT 1
- createFeed with POST_PRODUCT_DATA
- How to get raw request for SP API Developer Support? HOT 2
- Create Offer: Not Update Price, Quantity, and Merchant Shipping Group
- Authorization API v1 Deprecation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-sp-api.