Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails 4 - What authentication gem to use? [closed]

So in the past we had acts_as_authenticated, restful_authentication etc... But now there are a variety of options along with Rails itself having authentication functionality.

I'm about to start a new rails project and am interested in what everyone's preference (for non oAuth) authentication and what you would recommend I consider?

Thanks, Scott

like image 360
Scott Avatar asked Feb 20 '14 10:02

Scott


3 Answers

Devise is a full-featured authentication solution which handles all of the controller logic and form views for you.

  1. First, include the Devise gem in your Gemfile:

    gem 'devise' 'version-if-u-want-any specific'

  2. To install the newly-added gem, use:

    bundle install

  3. To install Devise, run:

    rails g devise:install

    and perform some settings manually, which are shown in the output of the command.

  4. (Optional) For customization purposes, we can include the Devise gem's views in our app's views:

    rails g devise:views

  5. (Optional) Generate the user model, which will be used by Devise:

    rails g devise user

  6. Migrate your database:

    rake db:migrate

  7. You can see routes using:

    rake routes

  8. For signing up users, visit:

    localhost:3000/users/sign_up

like image 122
Gopal S Rathore Avatar answered Nov 10 '22 04:11

Gopal S Rathore


Use Devise it's the best gem for authentication. You will find plenty of tutorial and help on the web. When I started my first rails app I used it and it was really easy to install and get it working.

Devise on Github

Railscast on Devise

That should get you started but don't hesitate to read the devise wiki you should be able to get everything running pretty easily

like image 23
Jeremy B Avatar answered Nov 10 '22 04:11

Jeremy B


You can take a look at https://www.ruby-toolbox.com/categories/rails_authentication

In my projects, I normally use devise.

like image 40
Bjoernsen Avatar answered Nov 10 '22 04:11

Bjoernsen