Van_Dude Van_Dude - 1 year ago 457
Javascript Question

How to generate HMAC-SHA256 in AngularJS?

I need to send a HTTP request with a HMAC-SHA256 signature for authentication.
I cant find any sources regarding this topic.

So how am I able to generate such a HMAC-SHA256 signature in AngularJS?


AngularJS is javascript. So, you need to be asking: "How to generate hmac-sha256" in javascript. This has been answered many times.

For example using "jsSHA" you can do:

var shaObj = new jsSHA(hashType, "TEXT");
shaObj.setHMACKey("abc", "TEXT");
shaObj.update("This is a test");
var hmac = shaObj.getHMAC("HEX");