Search code examples
restlaravel-5csrfdingo-api

CSRF with REST API laravel


I am new in laravel. I want to create REST API's with Laravel, I have used Dingo for it. Now my problem is when I am sending post request

CSRF token mismatch is error is throwing

and for web version we have used CSRF token for validating the request..

can anyone help me for solving CSRF token mismatch error in laravel 5.1.

Thanks in advance...


Solution

  • Don't use CSRF tokens in an API. You should remove the middleware from app/Http/Kernel.php (on line 20) and use a different authentication method for your API.