No commit activity in last 3 years
No release in over 3 years
Auth0 (https://auth0.com) is web service handling users identities which can be easily plugged into your application. It provides SDKs for many languages which enable you to sign up/in users and returns access token (JWT) in exchange. Access token can be used then to access your's Web Service. This gem helps you to verify (https://auth0.com/docs/api-auth/tutorials/verify-access-token#verify-the-signature) such access token which has been signed using the RS256 algorithm.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 12

Runtime

>= 2
>= 1.7
 Project Readme

Build Status

Auth0 JWT (RS256) verification library

Auth0 is web service handling users identities which can be easily plugged into your application. It provides SDKs for many languages which enable you to sign up/in users and returns access token (JWT) in exchange. Access token can be used then to access your's Web Service. This gem helps you to verify such access token which has been signed using the RS256 algorithm.

Installation

Install the auth0_rs256_jwt_verifier package from Rubygems:

    gem install auth0_rs256_jwt_verifier 

Install it using Bundler specifying it as dependency in your Gemfile:

    gem "auth0_rs256_jwt_verifier"

Usage

# Verifier caches RS256 certificates fetched from jwks_uri.
# You should initialize it once and reuse for JWTs verification.

require "auth0_rs256_jwt_verifier"

AUTH0_JWT_VERIFIER = Auth0RS256JWTVerifier.new(
  issuer:   "ISSUER",
  audience: "AUDIENCE",
  jwks_url: "https://YOUR_AUTH0_DOMAIN/.well-known/jwks.json"
)

result = AUTH0_JWT_VERIFIER.verify("JWT_ACCESS_TOKEN_SIGNED_USING_RS256_ALGORITHM")
if result.valid?
  p "Token is valid"
  p "User id: #{result.user_id}"
else
  p "Token is invalid"
end