Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access denied #61

Closed
Raidus opened this issue Oct 6, 2018 · 4 comments
Closed

Access denied #61

Raidus opened this issue Oct 6, 2018 · 4 comments

Comments

@Raidus
Copy link

Raidus commented Oct 6, 2018

Hi,

I'm always getting access denied although the credentials are correct since I've tested the same credentials with https://github.com/beardon/mws-api and the MWS Scratchpad

My Code:

const { MWS } = require("../config/dev.js");

const account = "XXXXXX"
const amazonMws = new MwsApi();

amazonMws.setApiKey(
  process.env.AWS_ACCESS_KEY_ID,
  process.env.AWS_SECRET_ACCESS_KEY
);


amazonMws.orders.search(
  {
    Version: "2013-09-01",
    Action: "ListOrders",
    SellerId: MWS.merchantId[account], //"SELLER_ID",
    MWSAuthToken: MWS.authToken, //"MWS_AUTH_TOKEN",
    "MarketplaceId.Id.1": MWS.MarketplaceId.de, //"MARKET_PLEACE_ID_1",
    LastUpdatedAfter: new Date(2018, 09, 24)
  },
  function(error, response) {
    if (error) {
      console.log("error ", error);
      return;
    }
    console.log("response", response);
  }
);
error products { 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-10-06T14:09:38.212Z',
     'content-type': 'text/xml',
     'content-charset': 'unknown',
     'content-length': '294',
     'content-md5': 'unknown',
     date: 'Sat, 06 Oct 2018 14:09:38 GMT' },
  StatusCode: 401,
  RequestId: '4ef544f5-810c-4a98-8654-2682f131b007' }
@bhushankummar
Copy link
Owner

@Raidus Possibly your AccessKey and SecretKey are wrong.

@Raidus
Copy link
Author

Raidus commented Oct 7, 2018

@bhushankumarl thanks for you feedback but as I've told you, I've tested the same credentials (AccessKey and SecretKey) with another module and with the MWS Scratchpad. Both worked.

@Raidus
Copy link
Author

Raidus commented Oct 7, 2018

solution was setting the correct marketplace:

amazonMws.setHost("mws.amazonservices.de");

@wangjue666
Copy link
Contributor

solution was setting the correct marketplace:

amazonMws.setHost("mws.amazonservices.de");
``wow it is so niiiiiiiiiiiice`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants