从php客户端调用rest post api时CSRF令牌无效

编程入门 行业动态 更新时间:2024-10-12 01:24:15
本文介绍了从php客户端调用rest post api时CSRF令牌无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在 Symfony 中创建了一个 rest api.它使用表单让客户端发送数据.我在 setDefaultOptions 中使用了 'csrf_protection' => false,但仍然收到错误

I have created a rest api in Symfony. It uses form for the client to send the data. I have used 'csrf_protection' => false in setDefaultOptions, but still getting the error

CSRF 令牌无效.请尝试重新提交表单

The CSRF token is invalid. Please try to resubmit the form

推荐答案

您是否通过 NelmioApiDocBundle sanbox,还是您从前端的表单发送数据?您确定您没有将 csrf_protection 请求参数发送到您的 api 吗?

Did you test your api over NelmioApiDocBundle sanbox, or your sending data from form on frontned side? Are you sure that your not sending csrf_protection requsest parameter to your api?

更多推荐

从php客户端调用rest post api时CSRF令牌无效

本文发布于:2023-10-10 09:23:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1478288.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:令牌   客户端   rest   php   CSRF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!