garrettmassey's avatar

Nova Logout: change page redirection to homepage

I recently changed the authentication for our application from the built-in username/password authentication to the microsoft MFA / azure authentication, and that changes the flow a bit.

The logging in works just fine, but when a user needs to log out of the application, Nova redirects them to the login page, which then kicks off the Azure MFA process, and because the user is logged in on microsoft, the Laravel auth session gets recreated and they are logged in again.

I'm trying to figure out how to force nova to redirect a user to the "/" route after clicking "logout". In my Nova.php config file, I have added this:

'routes' => [
    'login' => '/auth/login',
    'logout' => '/auth/logout',
],

and those /auth/login and /auth/logout routes point to the AuthenticatedSessionController::create and AuthenticatedSessionController::destroy methods. In the destory method, I destroy the session, log the user out, and then it should redirect to '/', but that doesn't seem to be happening. Nova keeps trying to redirect the users to the login page, and I'm not sure how to stop it.

1 like
2 replies
zor's avatar

Any update on this? I think my case is related.

I'm newbie in laravel. In my case, I have Oauth2 authentication provided by FusionAuth. If I click 'Keep me signed in' in FusionAuth login page, then go to nova page and click the logout, Nova redirects to the nova login page. But if I go to '/' route and try login, I automatically logged in without entering my credentials

DanielHdz's avatar

I use Route web.php

There's a command to call the controllers. In my case, it's one that sends a magic code to the phone number: sendcodecontroller.php

Once you're logged in and log out, the Auth is deleted.

In Route, I manage it like this:

Web.php

Route::get('/nova/login', function () { return redirect('/'); })->name('nova.sendcode');

1 like

Please or to participate in this conversation.