I am trying to get the current user in my laravel vue application. And whenever I trie to get it i am getting this error:
Symfony\Component\Routing\Exception\RouteNotFoundException:
- Route [login] not defined.
This is what I am sending in postman:
routes\api.php
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Add new config at headers
"Accept" => "application/json"
Laravel will check the configuration for "Accept", it will return the Web Page or HTML if no value is set at "Accept" by default.