简体   繁体   中英

Rails sessions fails first time and passes on reload

On login, and logout I end up getting this error when trying the first time. However, after refreshing it goes through.

"The change you wanted was rejected. Maybe you tried to change something you didn't have access to. If you are the application owner check the logs for more information."

In my logs I get an ActionController::InvalidAuthenticityToken error so it has to be something with my sessions however I can't find anything to add.

Are you using rails helpers to create the form?

If not, you might need to add a CSRF token field. Using rail's form helper does it automatically for you.

Update:

Also check if your application controller has protect_from_forgery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM