Verify Auth0 JWT token using RS256 with JWKS method.
Add this line to your application's Gemfile:
gem 'auth0-verifier'
Create file config/initializers/auth0.rb
and add:
Auth0::Verifier.configure do |config|
config.domain = 'test.auth0.com' # Defaults to ENV variable AUTH0_DOMAIN
config.audience = 'https://example.com' # Defaults to ENV variable AUTH0_AUDIENCE
# Optional:
#
# config.type = :RS256 # Default RS256 using JWKS
# config.jwks_url = 'https://test.auth0.com/.well-known/jwks.json' # Defaults to domain
end
Verify token:
Auth0::Verifier.verify('my token')
This library aims to support and is tested against the following Ruby implementations:
- Ruby 2.6
- Ruby 2.7
- Ruby 3.0
- Ruby 3.1
Bug reports and pull requests are welcome on GitHub at https://github.com/jpalumickas/auth0-verifier. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Everyone interacting in the Auth0 Verifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
Copyright (c) 2022 Justas Palumickas. See LICENSE for details.