after i started doing Authentication, using both, i started reciving such an error, as the documents say, i need to add the middleware,
'middleware' => [
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
``` as well as the guards,
```php
'guards' => ['sanctum'],
my cors
'paths' => [
'api/*',
'graphql',
'login',
'logout',
'sanctum/csrf-cookie'
],```
under bootstrap/app.php
```php
->withMiddleware(function (Middleware $middleware) {
$middleware->statefulApi();
})
and under my api route,
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:sanctum');
under my graphql schema
me: User @auth
if i remove everything about auth, the rest of the functionalities work just fine.
oh yeah! and i did include my authoriziation token in the http header,
{
"Authorization": "Bearer <token>"
}```