Hi all,
I am trying to adapt a script from postman where I successfully tested my API call. My issue is that the API secret key needs to be encrypted when I send the request but this requires Crypto-js.
Is there a workaround available in Airtable scripting block to make this work:
var CryptoJS = require('crypto-js')
// the Authorization header needs to have this very particular format, which the server uses to validate the request
// the access key is provided for the server to retrieve the API key; the signature is encrypted with the secret key
var hmacString = (method + '\n' + onNonce + '\n' + authDate + '\n' +
headers.get('Content-Type') + '\n' + path + '\n' + queryString + '\n').toLowerCase();
var signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(hmacString, secretKey));
var asign = 'On ' + accessKey + ':HmacSHA256:' + signature;
headers.append('Authorization', asign);
For reference the above code is from here : onshape-clients/postman at master · onshape-public/onshape-clients · GitHub using API keys method ; and so far I get this message {“message”:“Unauthenticated API request”, “status”:401}.
Thanks in advance for any help or pointers for where to look and find doc about this.
Cheers,
Robin