本文介绍了从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令牌无效
发布评论