Laravel 5: POST without CSRF checking

后端 未结 4 928
醉梦人生
醉梦人生 2021-01-17 19:07

It seems that Laravel 5 by default applies the CSRF filter to all non-get requests. This is OK for a form POST, but might be a problem to an API that POSTs DELETEs etc.

4条回答
  •  感情败类
    2021-01-17 19:30

    just listen to this. Just before 30 minute i was facing this same problem. Now it solved. just try this.

    Goto App -> HTTP-> Kernel

    open the kernel file.

    there you can see : \App\Http\Middleware\VerifyCsrfToken::class,

    just disable this particular code using //

    Thatz it! This will work!

    So that you can remove the middleware from the API calling (if you want so..)

提交回复
热议问题