Ruby On Rails Introduction
This multistep quickstart guide will walk you through managing authentication in your Ruby on Rails apps with Auth0.
Seed and Samples
The seed is a regular RoR app, with all the Auth0 dependencies set, but nothing more. It's an empty canvas meant to be filled as you follow along the steps of this quickstart. If you prefer this option download the seed from our GitHub repository and follow along.
You can also follow the samples that are included in each step. Each sample uses the seed project as starting point and applies each step configuration to it, so for example the Login sample would be the seed project plus the login configuration. If you choose to follow this approach continue reading, the rest of this document will guide you through setting up the required prerequisites.
Create a Client
Create a new client application in your Auth0 doashboard and retrieve the the domain, client ID and client secret for the app. The downloadable samples throughout the quickstart steps will be configured with your default app credentials.
Configure Callback URLs
A callback URL is a URL in your application where Auth0 redirects to after the user has authenticated. You can whitelist callback URLs for your app in the Callback URL field in your Application Settings. If no callback URLs are set, a mismatch error will be displayed when a user logs in.
For security purposes, you must add the callback URL of your app to your Client Settings.
Your callback URL is currently set to:
In this case, the callbackURL should look something like:
The project structure follows the regular Ruby on Rails application structure. The tree below displays the location of the most referred files in the quickstart.
To follow along with the integration steps, add the following dependencies to your
Gemfile and run
gem 'omniauth', '~> 1.3.1' gem 'omniauth-auth0', '~> 1.4.2'