// This code does the equivalent of the node code provided in the GDAX API docs var secret = 'PYPd1Hv4J6/7x...'; var timestamp = Date.now() / 1000; var requestPath = '/orders'; var body = JSON.stringify(""); // body goes here // create the prehash string by concatenating required parts var message = timestamp + method + requestPath + body; // Base64 decode the alphanumeric secret string var key = CryptoJS.enc.Base64.parse(secret); // Use it as key for SHA 256 HMAC var signedMessage = CryptoJS.HmacSHA256(message, key); // base 64 encode the digest output before sending in header var output = signedMessage.toString(CryptoJS.enc.Base64); return output;