Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise with existing database: 401 Unauthorized using valid password

I am trying to use devise for user authentication of my website. It uses an existing User table.

The table has username and password, however when I try to log in, I get the following error:

Completed 401 Unauthorized in 90ms.

Logs:

Started POST "/users/sign_in" for 127.0.0.1 at 2013-06-06 15:50:01 +0530
Processing by Devise::SessionsController#create as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"+uKE28LrkWW71EHeasDSDCENQogAGODfBc3ZJJLyi9U=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
 User Load (0.1ms)  SELECT `users`.* FROM `users` WHERE `users`.`email` = '[email protected]' LIMIT 1
Completed 401 Unauthorized in 90ms
Processing by Devise::SessionsController#new as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"+uKE28LrkWW71EHeasDSDCENQogAGODfBc3ZJJLyi9U=", "user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Sign in"}
like image 818
user2459261 Avatar asked Dec 28 '25 11:12

user2459261


1 Answers

Its solved! I changed the encryption key of the rails project in configs/initializers/devise.rb.

Rails version: 3.2.13 Devise version: 2.04

like image 80
user2459261 Avatar answered Dec 31 '25 03:12

user2459261