Reputation: 3258
Trying to access the Amazon SP-API via the ruby gem amz_sp_api. The gem works by getting an access_token
from the refresh_token
on every API request, so I just need a refresh_token
And no matter what I do I get:
Access to requested resource is denied
I am using this list of credentials to access the api:
refresh_token
client_id
client_secret
aws_access_key_id
aws_secret_access_key
region
I've read all the posts on the interwebs, and no luck. So I thought I'd paste in screen grabs of all the places where I'm getting these credentials and hoping someone can verify or discredit my mess. Here goes:
refresh_token
I am getting the refresh_token
via this URL that I constructed with application_id
https://sellercentral.amazon.com/apps/authorize/consent?application_id=amzn1.sp.solution.1233da7c-a329-49d7-9b29-a6e55de823e0&state=1237&version=beta
The application id was found here:
Next the client_id and client_secret
Then finally the aws_access_key_id and aws_secret_access_key that I got when creating my IAM user:
And yes I assumed the role for the AWS user and that role id looks like this:
arn:aws:iam::536EDITED:role/SellerAPIRole
Any idea where I went astray?
Upvotes: 0
Views: 3778
Reputation: 104
I was getting the same issue when using the Python sp-api. After hours of searching, I found what was missing. In my case it was the marketplace
parameter – and that resolved my issue.
Orders(credentials=credentials,marketplace=Marketplaces.IN).get_orders(CreatedAfter=(datetime.utcnow() - timedelta(days=20)).isoformat())
Upvotes: 3