Laravel “CSRF token mismatch” for POST with laravel-cors and axios
Please use routes/api.php for apis routing,don't use the routes/web.php for api.
If you want to use sub-domain then do required changes in following file:
app/Providers/RouteServiceProvider.php
Original:
protected function mapApiRoutes() { Route::prefix('api') ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php'));}
Updated:
protected function mapApiRoutes() { Route::domain('api.' . env('APP_URL')) ->middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php'));}