Hi,
we have communication problem with amazon.
Our client logs in to our service where he clicks button "Log in Amazon". He is then redirected to url https://sellercentral.amazon.pl/apps/authorize/consent?application_id=amzn1.sellerapps.app.xxxx-xxxx-xxx-xxx-xxx&state=here_is_unique_uid. On this page our partner accepts the usage for our application and is redirected back, from that action we get selling_partner_id and spapi_oauth_code. After that we send request on https://api.amazon.com/auth/o2/token with data:
{'grant_type': "authorization_code",
'code': spapi_oauth_code,
'redirect_uri': redirect_url,
'client_id': AMAZON_CLIENT_ID,
'client_secret': AMAZON_SECRET
}
where AMAZON_CLIENT_ID and AMAZON_SECRET are LWA credentials of app. In response we receive access_token and refresh token. Till this point everything works fine.
Now we try to get orders data:
1.
We request Login with Amazon access token on /auth/o2/token with params: client_id, client_secret (LWA credentials of app) grant_type=refresh_token, refresh_token=refresh token we have from previous step. In response we receive new access_token and refresh_token.
We create assume role request on sts.amazonaws.com using AWS_ACCESS from AWS for credential and AWS_SECRET from AWS for computing signature. From that response we get SessionToken and accesskeyid.
Final request for orders: GET on sellingpartnerapi-eu.amazon.com/orders/v0/orders in Authorization header for credential we use accesskeyid from assume role request, for X-Amz-Access-Token header we use access token from 1st request, and for X-Amz-Security-Token we send sessiontoken received from assumrole request for that data we receive 403 forbidden error
HTTP/2.0 403 Forbidden
Content-Length: 141
Content-Type: application/json
Date: Wed, 07 Apr 2021 13:33:57 GMT
X-Amz-Apigw-Id: daku6GYXDoEFQPw=
X-Amzn-Errortype: AccessDeniedException
X-Amzn-Requestid: 55ff0680-a7c1-412d-830d-cc3b018ea1b9
{
"errors": [
{
"message": "Access to requested resource is denied.",
"code": "Unauthorized",
"details": ""
}
]
}
We don't have idea what is wrong. Our app have a access permission to get order.
bug