Drupal中的CSRF验证失败 [英] CSRF validation failed in Drupal
问题描述
我在Drupal 7中使用webservice。如果我尝试使用海报我得到 CSRF 验证失败。之前,我连接了一个管理员帐户。
I'm using a webservice in Drupal 7. If I try to use Poster I get 'CSRF validation failed'. Before, I was connected with an administrator account.
我使用Firefox加载项海报。
I use the Firefox add-in Poster.
如何解决这个问题?
推荐答案
您需要在服务请求的标题中传递CSRF令牌。
You need to pass along the CSRF token in the header of the service request.
要检索令牌,导航到:
http:// www.example.com/?q=services/session/token
将令牌复制到剪贴板。
然后在FireFox海报中,使用标题标签,添加此名称和值:
Then in FireFox poster, using the "Headers" tab, add this name and value:
- 名称:X-CSRF -Token
- 值:[paste-the-token-value-here]
当您提出请求时,令牌将通过FireFox Poster正确传递。
Now when you make requests, the token will be passed along correctly with FireFox Poster.
这是一篇详细的博客文章,概述了这个主题:
Here's a detailed blog post outlining this topic:
http://tylerfrankenstein.com/code/drupal-services-csrf-token-firefox-poster 一>
这篇关于Drupal中的CSRF验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!