Tutorial by Examples

Add gem to the Gemfile: gem 'devise' Then run the bundle install command. Use command $ rails generate devise:install to generate required configuration file. Set up the default URL options for the Devise mailer in each environment In development environment add this line: config.action_mailer...
To set up a controller with user authentication using devise, add this before_action: (assuming your devise model is 'User'): before_action :authenticate_user! To verify if a user is signed in, use the following helper: user_signed_in? For the current signed-in user, use this helper: current_us...
First choose your auth strategy and add it to your Gemfile. You can find a list of strategies here: https://github.com/intridea/omniauth/wiki/List-of-Strategies gem 'omniauth-github', :github => 'intridea/omniauth-github' gem 'omniauth-openid', :github => 'intridea/omniauth-openid' You ca...
Create User Model rails generate model User email:string password_digest:string Add has_secure_password module to User model class User < ActiveRecord::Base has_secure_password end Now you can create a new user with password user = User.new email: '[email protected]', password: 'Password1', ...
Create User Model # Schema: User(token:string, auth_token:string) class User < ActiveRecord::Base has_secure_token has_secure_token :auth_token end Now when you create a new user a token and auth_token are automatically generated user = User.new user.save user.token # => "p...

Page 1 of 1