bhushankummar / amazon-mws

Amazon MWS NodeJS Wrapper
MIT License
197 stars 78 forks source link

Access Denied Error #56

Closed mohitgoyal201617 closed 6 years ago

mohitgoyal201617 commented 6 years ago

Hi,

I am trying to use below mws api using this module. But getting Access Denied error. But things are working fine if I use the same api with same parameters using scratchpad.

var amazonMws = require('amazon-mws')('AWS_ACCESS_KEY_ID','Sec_key');

amazonMws.products.searchFor({ 'Version': '2011-10-01', 'Action': 'GetLowestPricedOffersForSKU', 'SellerId': 'SellerID', 'MWSAuthToken': 'authtoken', 'MarketplaceId': 'A21TJRUUN4KGV', 'SellerSKU': 'skuid', 'ItemCondition': 'New' }, function (error, response) { if (error) { console.log('error ', error); return; } console.log('response ', response); });

Response:

error { Type: 'Sender', Code: 'AccessDenied', Message: 'Access denied', Headers: { 'x-mws-quota-max': 'unknown', 'x-mws-quota-remaining': 'unknown', 'x-mws-quota-resetson': 'unknown', 'x-mws-timestamp': '2018-09-22T16:16:09.909Z', 'content-type': 'text/xml', 'content-charset': 'unknown', 'content-length': '294', 'content-md5': 'unknown', date: 'Sat, 22 Sep 2018 16:16:09 GMT' }, StatusCode: 401, RequestId: '3511e62f-29e6-4112-bcb1-c938de071192' }

bhushankummar commented 6 years ago

This may due to invalid HOST, access key, secret key combination. The default host is :

mws.amazonservices.com

Are you working for India marketplace? You should change HOST if you are working for the different marketplace.

    amazonMws.setHost('YOUR HOST');