Skip to content

fix: respect redirectStartPage in PlatformAuthInteractionClient.acquireTokenRedirect#8604

Open
lalimasharda wants to merge 2 commits into
devfrom
bugfix/respect-redirectStartPage-in-acquireTokenRedirect
Open

fix: respect redirectStartPage in PlatformAuthInteractionClient.acquireTokenRedirect#8604
lalimasharda wants to merge 2 commits into
devfrom
bugfix/respect-redirectStartPage-in-acquireTokenRedirect

Conversation

@lalimasharda
Copy link
Copy Markdown
Contributor

Description

Bug: PlatformAuthInteractionClient.acquireTokenRedirect ignored request.redirectStartPage when navigateToLoginRequestUrl was true, always navigating to window.location.href instead.

Fix: When navigateToLoginRequestUrl is true, use request.redirectStartPage || window.location.href so that callers who set redirectStartPage are respected. When navigateToLoginRequestUrl is false, behavior is unchanged (falls back to redirectUri).

This aligns PlatformAuthInteractionClient with the existing behavior in RedirectClient, which already honors redirectStartPage.

Changes

  • lib/msal-browser/src/interaction_client/PlatformAuthInteractionClient.ts — use request.redirectStartPage (with window.location.href fallback) when navigateToLoginRequestUrl is true
  • lib/msal-browser/test/interaction_client/PlatformAuthInteractionClient.spec.ts — added two tests:
    • Navigates to redirectStartPage when provided
    • Falls back to window.location.href when redirectStartPage is not provided

…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>
@lalimasharda lalimasharda requested a review from a team as a code owner May 22, 2026 23:42
Copilot AI review requested due to automatic review settings May 22, 2026 23:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.acquireTokenRedirect to navigate to request.redirectStartPage || window.location.href when navigateToLoginRequestUrl is true.
  • Add unit tests covering both the explicit redirectStartPage case and the fallback-to-window.location.href case.

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.

@lalimasharda lalimasharda force-pushed the bugfix/respect-redirectStartPage-in-acquireTokenRedirect branch from 756d577 to 7b51a41 Compare May 22, 2026 23:57
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.

2 participants