Closed Muschke closed 2 years ago
Hello @Muschke,
Thank you for reaching out regarding "How to get Signature in Java".
You can find details regarding this in our Generating a Java SDK with LWA token exchange and authentication, Generating a Java client library, Automate your SP-API calls using Java SDK and Connecting to the Selling Partner API using a generated Java SDK.
If the information available in the documentation link provided above does not fully resolve your inquiry, please open a support case with us.
Thanks, Adrian C. Selling Partner API Developer Support
I'm trying to make the connections to the sp-api from my java program. We tested all the requests in Postman and are now trying to implement is. The developer docs are a bit vague. Since I have a lot of places where I can do something slightly different which results in a bad signature, it is a pain in the ass to get this right. Would you please take a look at my java code and comment on things that I do wrong or different?
` public ResponseEntity getAssumeRolCredentials() throws ApiException {
Just for the completion, I've added the functions I use above here below:
`
public class Aws4SignatureKeyGenerator { /function to generate signature/ static byte[] HmacSHA256(String data, byte[] key) throws Exception { String algorithm="HmacSHA256"; Mac mac = Mac.getInstance(algorithm); mac.init(new SecretKeySpec(key, algorithm)); return mac.doFinal(data.getBytes("UTF-8")); }
}
`