feat: return to current page after logout#411
Open
alukach wants to merge 2 commits into
Open
Conversation
The Logout button hit Ory's logout flow without a `return_to`, so users landed on Ory's configured default (the app root). Pass the current page URL as `return_to` — mirroring the existing login flow — so logout returns users to where they were. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Claude finished @alukach's task in 1m 31s —— View job Review
✅ No blocking issues — safe to merge.
|
new URL(CONFIG.auth.routes.logout) threw a TypeError in dev, where NEXT_PUBLIC_ORY_UI_URL is empty and the route is the same-origin relative path /self-service/logout/browser. The throw killed handleLogout, so the logout button did nothing. Pass window.location.origin as the base: it resolves the relative dev route and is ignored when the route is already absolute (prod). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Logout button in
AccountDropdownhit Ory's browser logout flow without areturn_toparam, so after logout Ory redirected users to its server-configured default (the app root). This passes the current page URL asreturn_toso users land back on the page they were on.This mirrors the existing login flow, which already passes the full current URL via
return_to(loginUrl/getReturnToUrl), so the mechanism is proven.Change
One line, client-side (
window.location.href), insrc/components/layout/AccountDropdown.tsx.Notes / caveats
return_tovalues inselfservice.allowed_return_urls. Login already returns to full same-origin URLs, so same-origin paths are almost certainly already allowed — that config lives outside this repo, worth a confirm./logoutroute, which also clears thesc_proxy_credscookie. Not addressed here — this PR is scoped to the redirect. Consolidating the two logout paths could be a follow-up.🤖 Generated with Claude Code