【发布时间】:2016-12-16 16:40:11
【问题描述】:
在 Rails 4 应用程序的同一页面上,我有一个
在头脑中:
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="some_token" />
正文以下:
<form action="/someaction" method="post">
<input name="utf8" type="hidden" value="✓" />
<input type="hidden" name="_method" value="patch" />
<input type="hidden" name="authenticity_token" value="another_token" />
js 调用需要 csrf 令牌。但是为什么form token 和csrf token 不一样呢?提交表单时使用了这两个令牌中的哪一个?
【问题讨论】:
标签: ruby-on-rails csrf authenticity-token