Secure a Rails API with Auth0

Learn how to secure an API written using Ruby On Rails with Auth0 authorization services.
Read more…

:writing_hand:t2: Brought to you by one of our Guest Author crew: Mario Fernandez

What are your thoughts folks? Share it in the comments!

Great guide. One thing to note is that token['permissions'] is now token['scope']

1 Like

Thanks for sharing that with the rest of community!

Hey, thanks for sharing this amazing guide!

Three things to point out:

  1. In Rails 6, if you put lib files under app/lib they are autoloaded, meaning you don’t have to load them manually in the ApplicationController.
  2. Rails.application.config.x.auth0 was returning an empty hash in my case, so I had to do: Rails.application.config_for(:auth0)[:Key-I-Need]
  3. I had some issues decoding the token, so for me on JWT.decode instead of iss: Rails.application.config.x.auth0.issuerUri, I used issuer: issuer,