Skip to content

Conversation

@shahzaibj
Copy link
Contributor

  • URL was being loweredcased which caused the purpose token to get lowercased and become invalid
  • At resume the authorization header value needs to have Bearer prefix
  • The Switch Browser URL were having double scheme (https) in them due to how they were being formed. Example https/https://www.myurl.com

This PR fixes the above mentioned issues.

@shahzaibj shahzaibj self-assigned this Jul 11, 2025
@github-actions
Copy link

❌ Work item link check failed. Description does not contain AB#{ID}.

Click here to Learn more.

@shahzaibj shahzaibj marked this pull request as ready for review July 11, 2025 19:44
Copilot AI review requested due to automatic review settings July 11, 2025 19:44
@shahzaibj shahzaibj requested review from a team as code owners July 11, 2025 19:44
Copy link
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

This PR addresses several small bugs in the switch browser flow by updating URI construction, ensuring the Authorization header includes the Bearer prefix, and correcting URL handling in the web view client.

  • Use Uri.parse and buildUpon instead of manual string splitting to construct switch browser URIs.
  • Prepend "Bearer " to the authorization code when building resume headers.
  • Fix inconsistent URL variable usage in processSwitchBrowserRequest.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
common/src/main/java/com/microsoft/identity/common/internal/ui/webview/switchbrowser/SwitchBrowserUriHelper.kt Replace manual URI building with Uri.parse(actionUri).buildUpon().
common/src/main/java/com/microsoft/identity/common/internal/ui/webview/switchbrowser/SwitchBrowserProtocolCoordinator.kt Add "Bearer " prefix to authorization header value.
common/src/main/java/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java Use url instead of formattedURL in processSwitchBrowserRequest.
changelog.txt Add patch entry for switch browser bug fixes.
Comments suppressed due to low confidence (1)

common/src/main/java/com/microsoft/identity/common/internal/ui/webview/switchbrowser/SwitchBrowserProtocolCoordinator.kt:137

  • Add or update a unit test to verify that the Authorization header value correctly includes the Bearer prefix when building the resume URI headers.
            val authorizationHeaderValue = "Bearer $code"

@p3dr0rv
Copy link
Contributor

p3dr0rv commented Jul 11, 2025

seems we need to update the unit test

@shahzaibj shahzaibj force-pushed the shahzaibj/broker-switch-browser-fixes branch from 1f05987 to a158dd5 Compare July 18, 2025 02:26
@shahzaibj
Copy link
Contributor Author

seems we need to update the unit test

Updated the UTs!

@shahzaibj shahzaibj merged commit 707011a into dev Jul 18, 2025
24 of 25 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.

5 participants