Skip to content

fix(auth): honour guest middleware under global auth middleware - #107

Merged
matt-rolley merged 3 commits into
v7from
fix/auth-guest-middleware
Oct 6, 2026
Merged

matt-rolley merged 3 commits into
v7from
fix/auth-guest-middleware

Conversation

@matt-rolley

Copy link
Copy Markdown
Contributor

Problem

guest middleware was a documented no-op. With enableGlobalAuthMiddleware: true, every route except the login path redirected to login — including pages marked middleware: 'guest'.

Auth middleware also fell back to /login (module default is /auth/login) and stored only to.path, dropping the query string from the post-login redirect.

Fix

  • Global auth middleware treats route meta that includes guest as public.
  • Default login path aligned to /auth/login.
  • Redirect query uses to.fullPath so query (and hash segment handling via fullPath) is preserved.
  • guest can bounce already-authenticated users off the login path to home.

guest was a documented no-op while global auth redirected every route
except the login path. Auth middleware now treats route meta including
'guest' as public, uses the module default login path /auth/login, and
preserves the full path (with query) in the post-login redirect.
@vercel

vercel Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nuxt-directus-sdk Ready Ready Preview Oct 5, 2026 4:58pm UTC
nuxt-directus-sdk-playground Ready Ready Preview Oct 5, 2026 4:58pm UTC

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 9, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nuxt-directus-sdk@107

commit: 97c2fcc

Aligns the middleware with fix/auth-redirect-validation so both
branches make the identical change to this line and merge cleanly in
either order. Comparing fullPath also means a home visit with a query
string still round-trips that query through the post-login redirect.
@matt-rolley
matt-rolley changed the base branch from main to v7 October 6, 2026 08:55
@matt-rolley
matt-rolley merged commit 2968954 into v7 Oct 6, 2026
5 checks passed

This branch was successfully deployed

2 active deployments
Preview – nuxt-directus-sdk-playground — 97c2fcc2 Deployed Oct 5, 2026 by vercel[bot]
Preview – nuxt-directus-sdk — 97c2fcc2 Deployed Oct 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant