Laravel Sanctum /login not found

Viewed 975

SPA : app.sp-ed.test

  • vue 3/ vuex 4/ axios / typscript

Laravel : sp-ed.test //api for api access, /nova for nova access, web routes for public access

  • laravel 8 / sanctum / nova / fortify

error on posting to /login: enter image description here

config/fortify.php

    <?php

use App\Providers\RouteServiceProvider;
use Laravel\Fortify\Features;

return [

    'guard' => 'web',

    'passwords' => 'users',

    'username' => 'email',

    'email' => 'email',

    'home' => env('SPA_URL') . '/dashboard',

    'prefix' => '',

    'domain' => 'sp-ed.test',

    'middleware' => ['web'],

    'limiters' => [
        'login' => 'login',
        'two-factor' => 'two-factor',
    ],

    'views' => false,

    'features' => [
        Features::registration(),
        Features::resetPasswords(),
        Features::emailVerification(),
        Features::updateProfileInformation(),
        Features::updatePasswords(),
        /* Features::twoFactorAuthentication([
            'confirmPassword' => true,
        ]), */
    ],

];

config/sanctum.php

<?php

return [

    'stateful' => explode(',', env(
        'SANCTUM_STATEFUL_DOMAINS',
        'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1'
    )),

    'expiration' => null,

    'middleware' => [
        'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
        'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
    ],

];

After hours of trying to settle the csfr token issue, vue/axios posts to the api can't find the /login route. To me the interesting point in this error is the middleware "ServeNova" being called. I have printed out the routes and the login route looks correct [image included]. This seems like a complex implementation and I'm sure I missed something small. Does anyone have an idea of what might be wrong here?

enter image description here

1 Answers

I don't fully understand why, but in my case i was facing the same issue and running php artisan migrate:fresh fixed the issue

Related