rails csrf validation in firefox

前提是你 提交于 2019-12-30 10:28:04

问题


I have a site created with Rails using Devise for authentication. It works perfectly fine in Chrome, but in Firefox I cannot log in. All I can see is a message in log: WARNING: Can't verify CSRF token authenticity And the login screen comes back without any error messages.

Can someone give me a hint where to look after what is happening?


回答1:


I had exactly the same problem. Login was working in Chrome and not in FF. The problem was not related to CSRF since I commented out protect_from_forgery and tried to signin but I wasn't allowed to. The only difference was that the warning message disappeared.

After some debugging I found out that the problem is related to session and :domain => :all setting for the session store.

MyApp::Application.config.session_store :cookie_store, key: '_myapp_session', :domain => :all

After I removed :domain => all, I was able to login using Firefox. Hope that this will help someone even though the answer arrives two months late.



来源:https://stackoverflow.com/questions/19132050/rails-csrf-validation-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!