Skip to content

Nova RedirectIfAuthenticated ('nova.guest') middleware does not automatically apply custom guards #6836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmsfwk opened this issue May 1, 2025 · 4 comments
Labels
bug Verified bug by the Nova team fix incoming A fix is in review

Comments

@jmsfwk
Copy link

jmsfwk commented May 1, 2025

  • Laravel Version: 11.44.1
  • Nova Version: 5.4.3 (Silver Surfer)
  • PHP Version: 8.4.6
  • Database Driver & Version: N/A
  • Operating System and Version: N/A but macOS 15.4
  • Browser type and version: N/A but Firefox 139
  • Reproduction Repository: N/A

Description:

The Nova Authenticate middleware will fetch the customised Nova guard from the config before running its checks.

$guard = config('nova.guard');
    
// ...
    
return parent::handle($request, $next, ...$guards);

The Nova RedirectIfAuthenticated does not do this, which leads to a loop, e.g. /nova -> /nova/login -> /nova -> ...

Detailed steps to reproduce the issue on a fresh Nova installation:

  1. Set up an additional authentication guard using a copy of web, so you have web then the new guard nova
  2. Set NOVA_GUARD=nova in .env
  3. Set the Nova login route to use the nova.guest middleware
  4. Try to access /nova and you should see the loop
@jmsfwk jmsfwk changed the title Nova RedirectIfAuthenticated ('nova.guest') middleware does not automatically apply Nova RedirectIfAuthenticated ('nova.guest') middleware does not automatically apply custom guards May 1, 2025
@crynobone crynobone added bug Verified bug by the Nova team fix incoming A fix is in review labels May 1, 2025
@crynobone
Copy link
Member

Set the Nova login route to use the nova.guest middleware

This isn't in the default installation, right?

@crynobone crynobone added needs more info More information is required and removed bug Verified bug by the Nova team fix incoming A fix is in review labels May 1, 2025
@jmsfwk
Copy link
Author

jmsfwk commented May 1, 2025

Set the Nova login route to use the nova.guest middleware

This isn't in the default installation, right?

No it's not, we're using custom authentication to use OAuth

@crynobone crynobone added bug Verified bug by the Nova team fix incoming A fix is in review and removed needs more info More information is required labels May 2, 2025
@crynobone
Copy link
Member

Fixed in 5.6.1

Copy link

github-actions bot commented May 8, 2025

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Verified bug by the Nova team fix incoming A fix is in review
Projects
None yet
Development

No branches or pull requests

2 participants