fix: respect redirectStartPage in PlatformAuthInteractionClient.acquireTokenRedirect#8604
Open
lalimasharda wants to merge 2 commits into
Open
fix: respect redirectStartPage in PlatformAuthInteractionClient.acquireTokenRedirect#8604lalimasharda wants to merge 2 commits into
lalimasharda wants to merge 2 commits into
Conversation
…reTokenRedirect When navigateToLoginRequestUrl is true, use request.redirectStartPage (falling back to window.location.href) instead of always using window.location.href. This aligns with RedirectClient behavior where redirectStartPage is respected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bug in PlatformAuthInteractionClient.acquireTokenRedirect where redirectStartPage was ignored when navigateToLoginRequestUrl is true, by using request.redirectStartPage with a window.location.href fallback. Adds unit tests to validate the corrected navigation behavior.
Changes:
- Update
PlatformAuthInteractionClient.acquireTokenRedirectto navigate torequest.redirectStartPage || window.location.hrefwhennavigateToLoginRequestUrlistrue. - Add unit tests covering both the explicit
redirectStartPagecase and the fallback-to-window.location.hrefcase.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/msal-browser/src/interaction_client/PlatformAuthInteractionClient.ts | Honors request.redirectStartPage when computing the navigation target for redirect flows. |
| lib/msal-browser/test/interaction_client/PlatformAuthInteractionClient.spec.ts | Adds regression tests verifying navigation respects redirectStartPage and falls back to window.location.href. |
756d577 to
7b51a41
Compare
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.
Description
Bug:
PlatformAuthInteractionClient.acquireTokenRedirectignoredrequest.redirectStartPagewhennavigateToLoginRequestUrlwastrue, always navigating towindow.location.hrefinstead.Fix: When
navigateToLoginRequestUrlistrue, userequest.redirectStartPage || window.location.hrefso that callers who setredirectStartPageare respected. WhennavigateToLoginRequestUrlisfalse, behavior is unchanged (falls back toredirectUri).This aligns
PlatformAuthInteractionClientwith the existing behavior inRedirectClient, which already honorsredirectStartPage.Changes
lib/msal-browser/src/interaction_client/PlatformAuthInteractionClient.ts— userequest.redirectStartPage(withwindow.location.hreffallback) whennavigateToLoginRequestUrlistruelib/msal-browser/test/interaction_client/PlatformAuthInteractionClient.spec.ts— added two tests:redirectStartPagewhen providedwindow.location.hrefwhenredirectStartPageis not provided