CSRF with REST API laravel - Stack Overflow

PHOTO EMBED

Wed Sep 20 2023 12:34:26 GMT+0000 (Coordinated Universal Time)

Saved by @Zeeshan0811

In your app\http\Middleware\VerifyCsrfToken.php file.

edit $except property with:

protected $except = [
  'yourapi/*' 
];
 Save
This will exclude your api routes from CSRF verification.And keep it up for other things like your frontend.
content_copyCOPY

https://stackoverflow.com/questions/35033704/csrf-with-rest-api-laravel