Security Authentication 401 Unauthorized

I tried to configure the application using the new rail application, I developed it correctly using gemfile and bundle install

after which the installed device using rails generates devise: install

created a new model using rails generate devize user

rake db: migrate to create a custom table

added devise_for :users do get 'users/sign_out', :to => 'devise/sessions#destroy' end to enter my browser

start rails server

go to localhost: 3000 / users / sign_up to create a new user

go to localhost: 3000 / users / sign_out to exit it.

go to localhost: 3000 / users / sign_in and try logging in again and did not follow these steps and sent me back to the login screen without logging in

 Started POST "/users/sign_in" for 127.0.0.1 at 2012-07-13 16:55:28 +0800 Processing by Devise::SessionsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"cbFEP0FJ/e2XYHfub3ZeI7nEX0nCheXzCDs2ner3Zw8=", "newuser"=>{"email"=>" henghong.lee@gmail.com ", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"} Completed 401 Unauthorized in 1ms Processing by Devise::SessionsController#new as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"cbFEP0FJ/e2XYHfub3ZeI7nEX0nCheXzCDs2ner3Zw8=", "newuser"=>{"email"=>" henghong.lee@gmail.com ", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"} Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/app/views/devise/shared/_links.erb (1.0ms) Rendered /Users/Kinnovate/.rvm/gems/ruby-1.9.3-p194/gems/devise-2.1.2/app/views/devise/sessions/new.html.erb within layouts/application (4.9ms) Completed 200 OK in 175ms (Views: 16.5ms | ActiveRecord: 1.3ms) 

How Can I Fix Completed 401 Unauthorized?

+4
source share
1 answer
 attr_accessor :password 

seems to be the cause of the problem, since this method does not create an encrypted password for the model

+1
source

Source: https://habr.com/ru/post/943647/


All Articles