Skip to content

Commit 910e48f

Browse files
authored
Fix for app link redirect from CCT due to forced browser preference, Fixes AB#3387976 (#2775)
Fixes [AB#3387976](https://dev.azure.com/IdentityDivision/Engineering/_workitems/edit/3387976) The previous fix seems to have addressed the issue only partially. Previous fix: #2745 Basically what's happening is that even with that flag CCT will sometimes still launch the URL in browser and this is happening because we're setting the browser's pkg name explicitly on the intent which tells the OS that this MUST be opened in the browser. Checked CCT logs and they print something like: `Launching in browser as Browser pkg was explicitly set on the Intent` Once we remove the explicit pkg name then OS finds the best possible app on the device to handle the intent. For an app link that's the the broker hosting app.
1 parent 6f0b749 commit 910e48f

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ vNext
1010
- [MINOR] Awaiting MFA Delegate now automatically returns the AuthMethods to be used when calling MFA Challenge (#2764)
1111
- [MINOR] SDK now handles SMS as strong authentication method #2766
1212
- [MINOR] Added error handling when webcp redirects have browser protocol #2767
13+
- [PATCH] Fix for app link redirect from CCT due to forced browser preference (#2775)
1314

1415
Version 22.1.0
1516
----------

common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/SwitchBrowserActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ class SwitchBrowserActivity : FragmentActivity() {
146146
} else {
147147
Logger.warn(methodTag, "CustomTabsService is NOT supported")
148148
browserIntent = Intent(Intent.ACTION_VIEW)
149+
browserIntent.setPackage(browserPackageName)
149150
}
150-
browserIntent.setPackage(browserPackageName)
151151
browserIntent.setData(processUri.toUri())
152152
startActivity(browserIntent)
153153
}

common/src/main/java/com/microsoft/identity/common/internal/ui/browser/CustomTabsManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ public synchronized boolean bind(final @Nullable Context context, @NonNull Strin
134134
final CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(createSession(null));
135135
builder.setSendToExternalDefaultHandlerEnabled(true);
136136
mCustomTabsIntent = builder.setShowTitle(true).build();
137-
mCustomTabsIntent.intent.setPackage(browserPackage);
138137
return true;
139138
}
140139

0 commit comments

Comments
 (0)