Last active
April 16, 2021 17:06
-
-
Save Martin91/03efa7e5ef21f6f0e92ebacad684ebe0 to your computer and use it in GitHub Desktop.
Revisions
-
Martin91 revised this gist
Mar 25, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,5 @@ var secretKey = pm.collectionVariables.get("secret_key"); var hash = CryptoJS.HmacSHA256(signatureBaseString, secretKey).toString(CryptoJS.enc.Hex); console.log("signature is: ", hash); pm.request.headers.add({key: "Authorization", value: hash}); pm.request.headers.add({key: "Content-Type", value: "application/json"}); -
Martin91 revised this gist
Mar 24, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ pm.collectionVariables.set("timestamp", timestampNow); var host = pm.collectionVariables.get("host"); var path = pm.request.url.getPath(); var requestURL = host + path; // https://github.com/postmanlabs/postman-app-support/issues/5043#issuecomment-414301254 var requestBody = Property.replaceSubstitutions(pm.request.body.raw, pm.collectionVariables.toObject()) var signatureBaseString = requestURL + "|" + requestBody; -
Martin91 revised this gist
Mar 24, 2020 . No changes.There are no files selected for viewing
-
Martin91 renamed this gist
Mar 24, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Martin91 revised this gist
Mar 24, 2020 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,7 @@ pm.collectionVariables.set("timestamp", timestampNow); var host = pm.collectionVariables.get("host"); var path = pm.request.url.getPath(); var requestURL = host + path; var requestBody = Property.replaceSubstitutions(pm.request.body.raw, pm.collectionVariables.toObject()) var signatureBaseString = requestURL + "|" + requestBody; var secretKey = pm.collectionVariables.get("secret_key"); -
Martin91 created this gist
Mar 24, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ var CryptoJS = require("crypto-js"); var Property = require('postman-collection').Property; var now = new Date(); var timestampNow = parseInt(now.getTime() / 1000); pm.collectionVariables.set("timestamp", timestampNow); var host = pm.collectionVariables.get("host"); var path = pm.request.url.getPath(); var requestURL = host + path; console.log("requestURL: ", requestURL); var requestBody = Property.replaceSubstitutions(pm.request.body.raw, pm.collectionVariables.toObject()) console.log("requestBody: ", requestBody); var signatureBaseString = requestURL + "|" + requestBody; var secretKey = pm.collectionVariables.get("secret_key"); var hash = CryptoJS.HmacSHA256(signatureBaseString, secretKey).toString(CryptoJS.enc.Hex); console.log("signature is: ", hash); pm.request.headers.add({key: "Authorization", value: hash});