talira

ruby-jwt

Ruby implementation of JSON Web Tokens (RFC 7519): the jwt gem

open sourceMITfree

ruby-jwt (the jwt gem) is a Ruby implementation of the RFC 7519 JSON Web Token standard. It signs, encodes and verifies tokens with the NONE, HMAC, RSASSA, ECDSA and RSASSA-PSS algorithms through OpenSSL, takes EdDSA through the jwt-eddsa gem, imports and uses JWKs, and can be extended with other algorithm implementations.

Problems it solves

  • sign and verify JWTs in a Ruby app
  • decode a JWT from an Authorization header in Rails
  • verify tokens with a JWK set in Ruby

Features

  • Encodes, signs and verifies JSON Web Tokens (RFC 7519)
  • HMAC, RSASSA, ECDSA and RSASSA-PSS through OpenSSL; EdDSA through jwt-eddsa
  • Imports JWKs to sign and verify tokens
  • Pluggable algorithm implementations

Limitations

  • Callers must pass the expected algorithm to JWT.decode; picking it dynamically lets an attacker bypass verification.1

Alternatives

The same job

These do what ruby-jwt does.

  1. OAuth (Ruby) OAuth 1.0 and 1.0a clients and servers in Ruby
  2. OAuth2 (Ruby) A Ruby gem for OAuth 2.0 clients, including OAuth 2.1 and OpenID Connect

Compare ruby-jwt with the top 3