尽管有适当的X-XSRF标头,但仍会收到Laravel CSRF令牌不匹配错误
与Laravel的后端一起使用棱角侧的前端,我似乎无法与Sanctum一起越过CSRF步骤。
很奇怪的是,我正在击中 /sanctum /csrf-cookie页面,然后将xsrf-token cookie返回(图像1),当我在Laravel击中我的 /auth路线时适当设置(图2),但它仍然给我带来CSRF代币不匹配错误。
预先感谢!
Working with an Angular front end with a Laravel back end, and I can't seem to get past the CSRF step with Sanctum.
The weird thing is that I'm hitting the /sanctum/csrf-cookie page and getting the XSRF-Token cookie back (image 1), and when I hit my /auth route in Laravel the X-XSRF-TOKEN header seems to be set appropriately (image 2), but it's still giving me the CSRF token mismatch error.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来我只需要从我的kernel.php中的API中间件组中删除确保FrontendRequestSarestateFul。
It looks like I just needed to uncomment the EnsureFrontendRequestsAreStateful line from the api middleware group in my Kernel.php.