Hi everyone, I am integrating amazon seller central with our Netsuite using our own proprietary system.
I am having trouble setting up the Auth for fetching data from Amazon, would like to know if anyone that have experience in this to can help guide me
e
Eric B
02/17/2024, 7:24 PM
The key is generating the AWS signature. I used Google's CryptoJS code. You also need to make sure to generate the canonical request.
Eric B
02/17/2024, 7:25 PM
function getAWSSignatureKey(key, dateStamp, regionName, serviceName) {
var kDate = CryptoJS.HmacSHA256(dateStamp, "AWS4" + key);
var kRegion = CryptoJS.HmacSHA256(regionName, kDate);
var kService = CryptoJS.HmacSHA256(serviceName, kRegion);
var kSigning = CryptoJS.HmacSHA256("aws4_request", kService);
return kSigning;
}
k
Ken
02/19/2024, 5:19 PM
Hi Eric B, i'm sorry is this for Amazon seller partner API?
e
Eric B
02/19/2024, 6:43 PM
Yes it works for both SP-API and Vendor Central.
k
Ken
02/19/2024, 7:11 PM
👍 I currently have refresh token, client id, and client secret
How can I use that function?
e
Eric B
02/19/2024, 7:29 PM
That's the easy part...refresh token with the client id and client secret just gets you an access token
Eric B
02/19/2024, 7:30 PM
you have to construct the request headers using the access token and part of that is knowing how to construct the canonical request to use for generating the aws signature