TokenMismatchException for API in Laravel 5.2.31

前端 未结 3 909
南旧
南旧 2021-01-18 15:06

What Am I trying?

I already have a website and I am trying Token based authentication for an API in same code and below is the start for sample auth

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-18 15:38

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

    Here edit $except property with:

    protected $except = [
      'api/*' 
    ];
    

    This will exclude your api routes from CSRF verification.

提交回复
热议问题