Try adding an "encodeURIComponent(signature)". If your signature doesn't have any offending characters, then it will work, but about half the time you'll have characters that need URI encoding. Here is what my block looks like: let hmac = crypto.createHmac('sha256', client.hmac_key);
let hmac_encryption_base64_digest = hmac.update(base_string_for_calculating_signature).digest('base64')
let uriencoded_hmac_encryption_base64_digest = encodeURIComponent(hmac_encryption_base64_digest). Let me know if that helps. The other issue might be the order of the string you're sending into the encryption. There is a very particular (sorted order