Ruby on Rails
This guide will show you how to implement the user authentication in a ROR application. For this tutorial, we will use the ROR demo from GitHub and show you step by step how to run it.
This tutorial assumes you have:
- Basic knowledge of HTML/CSS
- Ruby and Rails set up installed on your system
Get your credentials and whitelist your application domain as explained in this section. This is a mandatory step to successfully implement and run the demo.
You can clone the Auth Page demo repository on your system using below commands:
git clone email@example.com:LoginRadius/login-page-demos.git
git clone https://github.com/LoginRadius/login-page-demos.git
Now move to the diretory ROR demo using terminal
This is the file structure you will get in the ROR demo, let's see what each file does
public folder - Contains all the HTML, CSS and JS file to create UI for the test application.
Gemfile - Contains all the bare minimum ROR dependencies needed.
. -|bin/ -|app/ -|config/ -|lib/ -|public/ -|-- |-css/ -|-- |-icons/ -|-- |-js/ -|-- index.html -|-- profile.html -|Gemfile -|Rakefile
- Set your LoginRadius credentials on the client and server side in the following files
Set the generated
/config/application.yml with your credentials; an example is provided in
SITE_NAME: <your-site-name> API_KEY: <your-api-key> API_SECRET: <your-api-secret> CUSTOM_API_DOMAIN: "false"
To configure the login screen implementation, create
/public/js based on the example provided example in
commonOptions.apiKey = "<LoginRadius API Key>"; commonOptions.appName = "<App Name>";
- Running Application
Now Run the following commands in the root of the directory, where
gemfile is located
bundle exec figaro install
Run the server using
Then visit http://localhost:3000/demo from your local browser and you will see the application running. Once you click on login button it will redirect you to auth page.