Skip to content

Force full page visit when login redirects to a non-Sharp intended URL - #793

Merged
aguingand merged 1 commit into
10.xfrom
fix/login-redirect-to-non-sharp-intended-url
Nov 2, 2026
Merged

aguingand merged 1 commit into
10.xfrom
fix/login-redirect-to-non-sharp-intended-url

Conversation

@aguingand

Copy link
Copy Markdown
Contributor

Problem

Login (and 2FA, passkey, impersonation) submits are Inertia XHR requests, and Inertia follows redirects. When the intended URL is an app route outside Sharp (e.g. a page protected by the sharp_auth middleware), the redirect response was handled as an Inertia visit instead of a real navigation.

Fix

  • New RedirectsToIntendedUrl concern used by LoginController, LoginMultiFactorController, ImpersonateController, PasskeyAuthenticatedController and PasskeyRegisteredController.
  • When the request is an Inertia request and the target URL does not resolve to a code16.sharp.* route, it returns Inertia::location() (409 + X-Inertia-Location) to force a full page visit; otherwise it keeps the regular redirect.

Tests

Added tests in tests/Http/Auth/AuthenticationTest.php for an intended Sharp URL (regular redirect) and an intended non-Sharp URL (forced full page visit).

🤖 Generated with Claude Code

Inertia follows redirects in XHR, so after login an intended URL pointing to an
app route (e.g. one using the sharp_auth middleware) was rendered inside Sharp.
Redirect with Inertia::location when the intended URL is not a code16.sharp.* route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aguingand
aguingand merged commit 47aa68f into 10.x Nov 2, 2026
7 checks passed
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