简体   繁体   English

Laravel 419 使用 api 中间件组时 POST 出错

[英]Laravel 419 Error on POST when using api middleware group

I seem to be having trouble with an API endpoint, When I send a POST request I get a 419 error.我似乎在使用 API 端点时遇到问题,当我发送 POST 请求时出现 419 错误。 I understand that is usually a CSRF token issue, but since it is an API route using the "api" middleware group and not the "web" middleware group it shouldn't try to validate a CSRF token.我知道这通常是 CSRF 令牌问题,但由于它是使用“api”中间件组而不是“web”中间件组的 API 路由,因此不应尝试验证 CSRF 令牌。 So I am not sure what is causing this problem in my case.所以我不确定在我的情况下是什么导致了这个问题。

UPDATE: As suggested in a comment I tried running更新:正如评论中建议的那样,我尝试运行

php artisan cache:clear

Got the response "Application cache cleared."得到响应“应用程序缓存已清除”。 but the problem still persists.但问题仍然存在。

I seem to be having trouble with an API endpoint, When I send a POST request I get a 419 error.我似乎在使用 API 端点时遇到问题,当我发送 POST 请求时出现 419 错误。 I understand that is usually a CSRF token issue, but since it is an API route using the "api" middleware group and not the "web" middleware group it shouldn't try to validate a CSRF token.我知道这通常是 CSRF 令牌问题,但由于它是使用“api”中间件组而不是“web”中间件组的 API 路由,因此不应尝试验证 CSRF 令牌。 So I am not sure what is causing this problem in my case.所以我不确定在我的情况下是什么导致了这个问题。

UPDATE: As suggested in a comment I tried running更新:正如评论中建议的那样,我尝试运行

php artisan cache:clear

Got the response "Application cache cleared."得到响应“应用程序缓存已清除”。 but the problem still persists.但问题仍然存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM