Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
HTTP
HTTP (The Gem! a.k.a. http.rb) - a fast Ruby HTTP client with a chainable API, streaming support, and timeouts
In 2019 I wrote a post with this same subject and an extra tool: Knock.
With a few modifications in the gem source code, we could easily integrate Auth0 into our Rails API, but that on Rails 5. Rails 6 brought Zeitwerk code loader together, which makes it harder to perform the alterations suggested in my previous post.
Everything will be created under the class Auth0, and it'll be using HTTP gem to perform the quests, but feel free to decide over your code organization and tools.
Decoding JWTs is simple whit the help of an already implemented solution. In this section, I'll be using the ruby-jwt.