-
Notifications
You must be signed in to change notification settings - Fork 176
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
Aws Sign4 wrong calcualation #113
Comments
Please show me the code you’re using
…Sent from my iPhone
On Jun 4, 2020, at 1:28 AM, dipakb1 ***@***.***> wrote:
I am using API method "b) Directly making calls to Selling partner APIs".
I followed all the steps correctly:
Step 1. Request a Login with Amazon access token
--> This API is working successfully & Getting access token.
Step 2. Construct a Selling Partner API URI
After that, I took access_token and pass into options header request- x-amz-access-token.
Step 3. Add headers to the URI
Step 4. Create and sign your request
But, After calling API 'https://sellingpartnerapi-eu.amazon.com/vendor/orders/v1/purchaseOrders'.
I am getting a sign response with error-
'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method.'
Please suggest for how to calculate correct was4 signature in details.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I have already added a code-snippet. Do you think I have missed anything? |
Why is the service Also, please see https://github.com/mhart/aws4#aws4signrequestoptions-credentials for what options you can use to sign ( |
Also, are you doing this in the browser? If so, you might find https://github.com/mhart/aws4fetch easier to use |
Okay. I will make changes and let you know. |
I am using Selling partner API-
getting error - If I passed url: 'https://sellingpartnerapi-eu.amazon.com/vendor/orders/v1/purchaseOrders?includeDetails=true&createdBefore=2020-04-20T14:00:00-08:00&createdAfter=2020-04-14T00:00:00-08:00' |
This library is for signing requests using the Node.js http request method – as documented here: https://nodejs.org/docs/latest-v12.x/api/http.html#http_http_request_options_callback (the That error is not coming from this library ( |
You can see an example of how to make requests with Node.js in the README: https://github.com/mhart/aws4#example |
Also if you provide a link to the service documentation that says you should be using this method, I might be able to help |
I am sharing with you, documentation which I have used to calculate the sign. |
I have previously referred this link and also make some changes as per PDF which is given by Amazon. |
So it says there that the region has to be So you probably want to do something like this: let options = {
service: 'execute-api',
region: 'us-east-1',
host: 'sellingpartnerapi-eu.amazon.com',
path: '/vendor/orders/v1/purchaseOrders',
headers: {
'X-Amz-Access-Token': access_token,
'User-Agent': 'My App(Language=Node.js;Platform=Windows/10)'
}
}
let signedRequest = aws4.sign(options, {
secretAccessKey: secretAccessKey,
accessKeyId: accessKeyId,
})
// I'm assuming your external library needs this:
signedRequest.url = 'https://' + signedRequest.host + signedRequest.path
request(signedRequest, console.dir) |
Don't put |
Also, you can make the headers lowercase if you prefer – it shouldn't matter, but just in case it does... headers: {
'x-amz-access-token': access_token,
'user-agent': 'My App(Language=Node.js;Platform=Windows/10)'
} |
Actually you shouldn't have a Content-Type header in there because you're making a GET request |
Thank you so much @mhart
Thank you so much once again. |
Glad you got it to work 👍 |
I am using API method "b) Directly making calls to Selling partner APIs".
I followed all the steps correctly:
Step 1. Request a Login with Amazon access token
--> This API is working successfully & Getting access token.
Step 2. Construct a Selling Partner API URI
After that, I took access_token and pass into options header request- x-amz-access-token.
Step 3. Add headers to the URI
Step 4. Create and sign your request
After completing 4 steps, my code are as follows:
But, After calling API 'https://sellingpartnerapi-eu.amazon.com/vendor/orders/v1/purchaseOrders'.
I am getting a sign response with error-
'The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method.'
Please suggest for how to calculate correct was4 signature in details.
The text was updated successfully, but these errors were encountered: