Use Laravel Sanctum SPA auth and Auth UI together

Viewed 839

I have a set up that has a Vue SPA which ordinary users use. I also am creating a system admin area which is not part of the SPA but part of the Laravel application (blade views etc).

Happy with authenticating the SPA as per https://laravel.com/docs/7.x/sanctum#spa-authentication

However when trying to log in using auth ui (bootsrap) into my admin area which is a blade view I seem to get 302 redirection back to log in page all the time.

Does Sanctum work with web auth middleeware?

My env file is as follows:

SANCTUM_STATEFUL_DOMAINS=localhost,127.0.0.1
SESSION_DOMAIN=localhost

Web routes file

Route::group(['middleware' => ['auth']], function () {
   Route::get('accounts', 'Admin\AdminController@index'); });

API middleware in Kernel.php

 'api' => [
        EnsureFrontendRequestsAreStateful::class,
        'throttle:60,1',
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
    ],
0 Answers
Related