Closed grempe closed 8 years ago
Insecure token example in README also seems broken:
unsecured_jwt_example = 'eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt.'
[9] pry(main)> unsecured_jwt_example = 'eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt.'
=> "eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt."
[10] pry(main)> JsonWebToken.verify(unsecured_jwt_example, alg: 'none')
RuntimeError: Algorithm not matching 'alg' header parameter
from /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json_web_token-0.3.1/lib/json_web_token/jws.rb:80:in `validate_alg_match'
[11] pry(main)>
I submitted a pull request with the fix in the jwt_claims
gem for this README issue in that repo.
https://github.com/garyf/jwt_claims/pull/2/commits/e3357e1f104e5b387d5d9b39623f9f9aed5b7279
The following token, part of your example code in the README (in both this repository and in the
jwt_claims
repo as well!), is invalid.Tested with
json_web_token
gem:Shows truncated payload output when tested in the https://jwt.io/ debugger and signature does not verify there.