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
611 stars 733 forks source link

Access to requested resource is denied, Unauthorized #933

Closed midi-red closed 2 years ago

midi-red commented 3 years ago

Opened a case on December 23, 2020: ID: 7779900511

I have been trying to use Amazon SP-API recently but somehow I am getting Unauthorized message. I followed all the steps on Amazon Selling API Developer Guide, and successfully went through all of them. I also created an app under Seller Central > Apps & Services > Develop Apps. But I am still getting this error for any type of api call for java client:

Error while trying to fetch marketplace participations: com.amazon.sellingpartner.ApiException: Forbidden at com.amazon.sellingpartner.ApiClient.handleResponse(ApiClient.java:953) at com.amazon.sellingpartner.ApiClient.execute(ApiClient.java:869) at com.amazon.sellingpartner.api.SellersApi.getMarketplaceParticipationsWithHttpInfo(SellersApi.java:143) at com.amazon.sellingpartner.api.SellersApi.getMarketplaceParticipations(SellersApi.java:130) at sample.spapi.SPAPI.getMarketplaceParticipations(SPAPI.java:46) at sample.spapi.Main.main(Main.java:12)

I also tried to test several APIs using curl but I am getting same error: { "errors": [ { "message": "Access to requested resource is denied.", "code": "Unauthorized", "details": "" } ] }

I can confirm that I am able to get x-amz-access-token and X-Amz-Security-Token. Here is a sample request I make with curl: curl --location --request GET 'https://sellingpartnerapi-na.amazon.com/sellers/v1/marketplaceParticipations' --header 'x-amz-access-token: Atza|IwEBIMrpzN5AIsBvquB2YRCg2ZzjCMzWV8ogtRjr4z72schJkGxG0lx_ZBJfzaAhp7hMU2Ef6fVX_7xo6m_6C8Hr9_t4li2Zh6YJriixCLcouEzB_NG5Otz8G-qpMH**** --header 'X-Amz-Security-Token: FwoGZXIvYXdBraaJtuNdkrr/1iCKwARqPIJ8****' --header 'X-Amz-Date: 20201212T040340Z' --header 'Authorization: AWS4-HMAC-SHA256 Credential=ASIAW27S6DNFWJCPUDUQ/20201212/us-east-1/execute-api/aws4_request, SignedHeaders=host;x-amz-access-token;x-amz-date;x-amz-security-token, Signature=ba9473e7842443ce6a66190770cc95****'

Any help is appreciated. Operation:Any operation MarketplaceId:ATVPDKIKX0DER RequestId:8ce87d51-f910-4953-bc64-7a04e424808f TimeStamp:X-Amz-Date: 20201223T191635Z, Date: Wed, 23 Dec 2020 19:16:35 GMT

midi-red commented 3 years ago

Hi @nodisk8800 yes, I am attaching the following policy to my IAM user. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "execute-api:Invoke", "Resource": "arn:aws:execute-api:::*" } ] }

premkumar-gg commented 3 years ago

Is your pro seller account "all green". Check your Account info and see if there are any warnings. In my case this helped.

ShivikaK commented 3 years ago

Hello,

We have received your support case 7779900511 and it is assigned to a Support Engineer.

Please expect an update on the case within this week.

Thanks, 
Shivika Khare
 Selling Partner API Developer Support