By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login#16961
Merged
Conversation
The management UI already remembers the page a user was on before an
OAuth login (the oauth-return-to pref) and restores it in the
sp_initiated flow via oauth_redirectToHome(). The idp_initiated flow
never restored it: start_app() always sent the user to '#/'.
idp_initiated has no dedicated OAuth callback page. The identity provider
POSTs the token to /login, the broker sets a cookie and redirects to '/',
and the app re-enters through the normal index.html -> start_app(). So
start_app() cannot tell a fresh login from a plain visit to '/': both
arrive with no hash. Reading oauth-return-to on every hashless load would
make every visit to '/' jump to the last saved page.
This change:
- Captures oauth-return-to in oauth_initiateLogin (at the login click)
rather than on page load, so a user who opens a URL and then navigates
before logging in returns to the page they actually left from.
- Sets a one-shot oauth-idp-pending marker for idp_initiated logins,
which have no callback page to key the restore on.
- In start_app, restores oauth-return-to only when oauth-idp-pending is
set, then clears both. A plain visit to '/' has no pending login and
goes home instead of jumping to the last saved page.
- Adds Selenium regression tests (with-idp-initiated/oauth-return-to.js)
covering: login from home stays on home; login from a deep-linked page
returns to it; navigating before login returns to the last page; and a
plain visit to '/' after login goes home (one-shot restore).
sp_initiated is unchanged; it keeps its own one-shot restore via
oauth_redirectToHome().
12 tasks
|
Tick the box to add this pull request to the merge queue (same as
|
Collaborator
Author
|
Note that we can only backport this after |
Collaborator
Author
|
The OCI failure has to do with an expired token. |
Collaborator
Author
|
@thisisnsh congratulations on your first contribution! Well done 👍👍 |
Contributor
Thanks 😄 |
michaelklishin
added a commit
that referenced
this pull request
Jul 20, 2026
For `4.3.4`: By @thisisnsh: Restore the pre-login page after an idp_initiated OAuth login (backport #16961)
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.
This is #16957 by @thisisnsh with a small usability fix from me.