devise
devise copied to clipboard
redirecto not working after sign_in and bypass_sign_in in Chrome
Environment
- Ruby 2.6.5
- Rails 6.0.3.2
- Devise 4.7.2
Current behavior
After manually sign_in or bypass_sign_in methods do not redirecting, and response never come back to chrome browser
def my_login_action
...
sign_in(@user)
redirect_to some_path
...
end
I test it in Firefox and Safari, but it's work perfectly, maybe new versions of Chrome has some more strict security rules and it's not possible to set some cookies/session
Expected behavior
sign_inand bypass_sign_in should redirect to desired location.
I have the same problem. Can somebody help?
@mespina Could you provide a sample app?
I have a similar problem, although for me it only happens intermittently. Here are my 2 log outputs:
When the error happens:
Started GET "/users/sign_in" for 127.0.0.1 at 2020-04-22 19:57:44 +0800
Processing by Users::SessionsController#new as HTML
...
Completed 200 OK in 62ms (Views: 60.1ms | ActiveRecord: 0.0ms)
Started POST "/users/sign_in" for 127.0.0.1 at 2020-04-22 19:57:57 +0800
Processing by Users::SessionsController#create as HTML
...
Redirected to http://localhost:3000/home
Completed 302 Found in 173ms (ActiveRecord: 9.6ms)
END OF OUTPUT
And here it is when is succeeds:
Started GET "/users/sign_in" for 127.0.0.1 at 2020-04-22 20:14:57 +0800
Processing by Users::SessionsController#new as HTML
...
Completed 200 OK in 58ms (Views: 56.5ms | ActiveRecord: 0.0ms)
Started POST "/users/sign_in" for 127.0.0.1 at 2020-04-22 20:15:03 +0800
Processing by Users::SessionsController#create as HTML
...
Redirected to http://localhost:3000/home
Completed 302 Found in 154ms (ActiveRecord: 4.0ms)
Started GET "/home" for 127.0.0.1 at 2020-04-22 20:15:03 +0800
Processing by HomeController#index as HTML
END OF OUTPUT
i.e. it's practically identical, except when the error happens, it simply doesn't do the redirect that it says it was told to do (and when debugging, the error case wouldn't hit the HomeController#index method).
It happens so rarely though, I don't know how to reliably reproduce it. This comment: https://github.com/heartcombo/devise/issues/4742#issuecomment-354670892 made me think it could be intermittent because of request.env["devise.skip_timeout"], but I don't use :timeoutable, so I ruled that out (plus, I confirmed my user is valid, so it's not a validation error thing).
- Ruby 2.6.4
- Rails 5.2.2.1
- Devise 4.7.1
Same thing happening for me. Log outputs are identical and can't reproduce reliably. Ruby 2.6.5, Rails 6.0.3.4, Devise 4.7.3.
I am also experiencing this
Same happening here. Ruby 2.7.5 Rails 6.1.4.6 Devise 4.8.1
I am also experiencing this ruby '3.1.2' gem 'rails', '~> 7.0.2.3' devise (4.8.1)
is there any solution guys?