json_web_token_ex icon indicating copy to clipboard operation
json_web_token_ex copied to clipboard

Non-banged `verify/2` throws exceptions

Open nihalgonsalves opened this issue 7 years ago • 0 comments

iex(1)> JsonWebToken.verify("foobar", %{key: "barbaz"})    
** (RuntimeError) Failed to decode header from JSON
    (json_web_token) lib/json_web_token/jws.ex:95: JsonWebToken.Jws.header_map/1
    (json_web_token) lib/json_web_token/jws.ex:82: JsonWebToken.Jws.validate_alg_matched/2
    (json_web_token) lib/json_web_token/jws.ex:77: JsonWebToken.Jws.verify/3
    (json_web_token) lib/json_web_token/jwt.ex:89: JsonWebToken.Jwt.verify/2

I would expect that it should return {:error, "invalid"} or something similar, as it isn't the banged verify!/2 version of the function.

nihalgonsalves avatar Aug 15 '18 11:08 nihalgonsalves