-
add request header, for instance X-Api-Token with value
{{secret}} -
provide a pre-request script which builds the secret token and stores it to the global or environment variable named
secretvar privateKey = postman.getEnvironmentVariable("privateKey"); var body = request.method === 'GET' ? '' : request.data; var hash = CryptoJS.HmacSHA256(body, privateKey); var hashInHex = CryptoJS.enc.Hex.stringify(hash); postman.setEnvironmentVariable("secret", hashInHex);
Created
August 1, 2016 19:26
-
-
Save angyvolin/b53d4f0669d254006f2bf05f07035591 to your computer and use it in GitHub Desktop.
Use Postman pre-request script for custom authentication
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment