amzn / selling-partner-api-models

This repository contains OpenAPI models for developers to use when developing software to call Selling Partner APIs.
Apache License 2.0
612 stars 736 forks source link

Acces Denied #1175

Closed WLplants closed 2 years ago

WLplants commented 3 years ago

We are trying to integrate our PIM system to the Amazon SP-API. We would like to do this without places the application on the Amazon Marketplaces for webapps.

Whatever we try to do, we get error that the access is being denied.

We tried various thing, but can not manage to find a fix. Is there anyone who have connected with the SP-API before and that would like to help me with it?

I keep getting the following error:

image (3)

stefnats commented 3 years ago

The Screenshot shows the MWS Scratchpad which allows to tinker with the old MWS API which will be deprecated some day. This has nothing to do with the new Selling Partner API.

Are you just trying a few things with the MWS Scratchpad? Can you share more details what you do and what does not work? Did you follow the Developer Guide?

WLplants commented 3 years ago

@stefnats , We do not want to place the application on the marketplace, so we made generated a refresh token to self authenticate us. Afterwards we are not sure what to do next.

My developer wants to know whether it is possible to test the API without doing the complete signing by himself since this seems a little hard to do. Is there a example or something to test the API?

stefnats commented 3 years ago

You should really follow the guide, with that knowledge you can do what you are trying to achieve.

Mitalee commented 3 years ago

@stefnats , We do not want to place the application on the marketplace, so we made generated a refresh token to self authenticate us. Afterwards we are not sure what to do next.

My developer wants to know whether it is possible to test the API without doing the complete signing by himself since this seems a little hard to do. Is there a example or something to test the API?

I think this is what you are looking for: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/use-case-guides/authorization-api-use-case-guide.md.

WLplants commented 3 years ago

@Mitalee , we can not use MWS since Amazon do not let new developers work with MWS, only with the new SP-API. The goal of our application is to use it for our own Amazon Seller account. I do not think it will be a hybrid application since we have never connected with the MWS API.

We are able to to do the self authorization: https://developer.amazon.com/docs/login-with-amazon/authorization-code-grant.html , but can not get further than that. Is there a way to test that everything is working right before we start building the application from scratch?

Mitalee commented 3 years ago

We are able to to do the self authorization: https://developer.amazon.com/docs/login-with-amazon/authorization-code-grant.html , but can not get further than that. Is there a way to test that everything is working right before we start building the application from scratch?

We did this as well. There's no way to move seamlessly between LWA (Login with Amazon) and SP-API because the two are very different systems. They could be connected with the scope parameter, which we tried but got an insufficient scope error.

You would have to create an app in the Developer section with the type SP-API and use those credentials (https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#self-authorization). I really wish the amazon guys see this and integrate both LWA and SP-API.

WLplants commented 3 years ago

@Mitalee , we dit, see the attached screenshot. Do we need to fill something in at OAuth? And how do we know what to fill in?

image

Mitalee commented 3 years ago

yes, at the minimum, the redirect URI (usually a callback method defined in your application). It will return to you a variable called spapi_oauth_code and state. For more details you can read this: https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#step-0-set-up-an-authorize-button

WLplants commented 3 years ago

@Mitalee is it possible to schedule a call with you and my developer to check what we have to do? Perhaps that will make things clear.

stefnats commented 3 years ago

We are able to to do the self authorization: https://developer.amazon.com/docs/login-with-amazon/authorization-code-grant.html , but can not get further than that. Is there a way to test that everything is working right before we start building the application from scratch?

We did this as well. There's no way to move seamlessly between LWA (Login with Amazon) and SP-API because the two are very different systems. They could be connected with the scope parameter, which we tried but got an insufficient scope error.

You would have to create an app in the Developer section with the type SP-API and use those credentials (https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#self-authorization). I really wish the amazon guys see this and integrate both LWA and SP-API.

We experienced that as well and it would make a great benefit.

@WLplants i think you need to first follow the Developer Guide step by step. It's actually pretty clear. Maybe the library for the programming language that you're using has some built-in features that will assist you.

The flow to make a call is something like this:

  1. Use Refresh Token to get an access token
  2. If you've registered your app with a Role ARN, you need to call STS Assumerole and attach the Security-Token to your SP-API Request
  3. Calculate the Signature for your request (the library that you're using will most likely do that)
  4. Send that Signature as well as other headers (like X-Amz-Date) within your SP-API Request

I hope that helps and gives a good overview over making an API Call.

vikingcodes commented 3 years ago

@WLplants which stack you using ?

rugved1991 commented 3 years ago

Hi @WLplants,

You should follow these sections of the Guide: Registering your Selling Partner API application -> Self authorization -> Connecting to the Selling Partner API You should use the refresh token received from Seller Central to get access token using the "refresh_token" in grant_type.

You can follow the steps mentioned in the Connecting to the Selling Partner API section to make a successful API call. If you are still running into issues, feel free to add more details.

Best, Rugved Solutions Architect, SP API

stefnats commented 3 years ago

@WLplants just curious, did the solution from @rugved1991 work?

WLplants commented 3 years ago

We did not find a solution for the problem. We are now using a integrator to list our products.

In case you have any other solutions, please contact us 😊

Van: stefan @.> Verzonden: woensdag 19 mei 2021 10:27 Aan: amzn/selling-partner-api-docs @.> CC: Sander van Lith @.>; Mention @.> Onderwerp: Re: [amzn/selling-partner-api-docs] Acces Denied (#551)

@WLplantshttps://github.com/WLplants just curious, did the solution from @rugved1991https://github.com/rugved1991 work?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/amzn/selling-partner-api-models/issues/1175, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATPISY3WUJG36MHDKWSACRTTONY63ANCNFSM42ETYYNQ.

github-actions[bot] commented 2 years ago

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue after the latest release and if you find that this is still a problem, please feel free to open a new issue and make a reference to this one.