function :crypto.hmac/3 is undefined or private
I think the newer version of crypto.hmac has 4 arguments instead of 3 (OTP 20 and above?).
** (UndefinedFunctionError) function :crypto.hmac/3 is undefined or private
(crypto 5.0) :crypto.hmac(:sha256, "xxxxxxxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx")
lib/json_web_token/algorithm/hmac.ex:35: JsonWebToken.Algorithm.Hmac.verify?/4
lib/json_web_token/jws.ex:103: JsonWebToken.Jws.verified/3
lib/json_web_token/jwt.ex:89: JsonWebToken.Jwt.verify/2
I'm getting the same error, but :crypto:mac/4 is recommended:
** (UndefinedFunctionError) function :crypto.hmac/3 is undefined or private, use crypto:mac/4 instead
Who has managed to resolve this.
Stumbled upon the same problem. Too bad this is the first library mentioned at jwt.io for Elixir and it is not maintained nor working.
I ended up using Erlang's JWErl library. Pretty easy to use also from Elixir, is still maintained and works as promised. There's some lack of documentation if need to use some options, but it's possible to get this information from tests.