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

To follow along with this quickstart you can either download the seed project or the samples provided at each page of this quickstart.

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 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 a 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 dashboard and retrieve 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.

App Dashboard

Configure Callback URLs

A callback URL is a URL in your application where Auth0 redirects to after the user has authenticated. You need to whitelist a callback URL for your app in the Callback URLs field in your Client 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:

3. Structure

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.

├── app
│   ├── assets
│   │   └── javascripts
│   │       └──home.js.erb
│   ├── controllers
│   │   └── concerns
│   │   |   └── secured.rb
│   │   └── home_controller.rb
│   │   └── dashboard_controller.rb
│   │   └── auth0_controller.rb
│   └── views
│       └── auth0
│       │   └── failure.html.rb
│       └── dashboard
│       │   └── show.html.rb
│       └── home
│           └── show.html.rb
└── config
│    └── initializers
│    │   └── auth0.rb
│    └── routes.rb
│    └── secrets.yml
└── .env


To follow along with the integration steps, add the following dependencies to your Gemfile and run bundle install

gem 'omniauth', '~> 1.3.1'
gem 'omniauth-auth0', '~> 1.4.2'
Next Tutorial
2. Login
Use Auth0 for FREECreate free Account