Add AuthTab (Chrome 137+) support for browser-based authentication flows, Fixes AB#3533538#2999
Draft
Add AuthTab (Chrome 137+) support for browser-based authentication flows, Fixes AB#3533538#2999
Conversation
|
✅ Work item link check complete. Description contains link AB#3533538 to an Azure Boards work item. |
1 similar comment
|
✅ Work item link check complete. Description contains link AB#3533538 to an Azure Boards work item. |
…rowserActivity, CustomTabsManager helper, AttributeNames, SpanName, and tests Co-authored-by: shahzaibj <37125644+shahzaibj@users.noreply.github.com>
…omTabsManager Javadoc, add changelog entry Co-authored-by: shahzaibj <37125644+shahzaibj@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement full AuthTab support in Common repo, Fixes AB#3533538
Add AuthTab (Chrome 137+) support for browser-based authentication flows
Mar 4, 2026
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.
Implements
AuthTabIntentfromandroidx.browser:browser:1.9.0as an alternative to Custom Tabs for interactive auth. AuthTab returns results viaActivityResultCallbackinstead of intent redirects, improving security. Gated behind a newENABLE_AUTH_TABfeature flag (default off).Feature Flag
ENABLE_AUTH_TAB("EnableAuthTab", false)toCommonFlight.javaDependency
browserVersion:1.7.0→1.9.0New:
AuthTabAuthorizationFragment(MSAL browser flows)AuthorizationFragment; registersActivityResultLauncherinonCreate()before STARTED stateAuthTabIntentinonResume()with URL + redirect scheme extracted from fragment argsAuthResultcodes:RESULT_OK→fromRedirectUri,RESULT_CANCELED→ cancel,RESULT_VERIFICATION_FAILED/TIMED_OUT→ exception resultmAuthResultSentAuthTabAuthorizationspan withis_auth_tab_usedandauth_tab_result_codeattributesUpdated:
AuthorizationActivityFactoryAuthTabAuthorizationFragmentwhenENABLE_AUTH_TABis on; falls back toBrowserAuthorizationFragmentUpdated:
SwitchBrowserActivity(DUNA flows)ActivityResultLauncherinonCreate()beforesuperlaunchBrowser()short-circuits to AuthTab when flag is on +isAuthTabSupported()returns truehandleAuthTabResult()parsesRESULT_OKredirect URI query params into the switch-browser bundle forWebViewAuthorizationFragmentNew:
CustomTabsManager.isAuthTabSupported()Wraps
CustomTabsClient.isAuthTabSupported()with null-safety and logging.Telemetry
AttributeName:is_auth_tab_used,auth_tab_result_code,auth_tab_supported(note: Broker repo sync required)SpanName:AuthTabAuthorizationWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Xmx3072m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant(dns block)identitydivision.pkgs.visualstudio.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Xmx3072m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant(dns block)www.puppycrawl.com/opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-b2678d0398b00160/dbs/java/working/files-to-index8571831542820985369.list --sourceArchiveDir=/tmp/codeql-scratch-b2678d0398b00160/dbs/java/src --outputDir=/tmp/codeql-scratch-b2678d0398b00160/dbs/java/trap/java(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes AB#3533538
Objective
Implement full AuthTab support in the Common repo: add the
ENABLE_AUTH_TABfeature flag toCommonFlight, create a newAuthTabAuthorizationFragmentfor MSAL browser flows, updateAuthorizationActivityFactoryto route to it, updateSwitchBrowserActivityfor DUNA flows, add anisAuthTabSupported()helper inCustomTabsManager, and bumpandroidx.browserto 1.9.0.Target Repository
Context
Chrome 137+ introduces AuthTab (
AuthTabIntentfromandroidx.browser:browser:1.9.0), a specialized Custom Tab for authentication. AuthTab returns results viaActivityResultCallbackinstead of intent-based redirects, improving security and simplifying the flow. This PBI implements AuthTab support for two paths:AuthTabAuthorizationFragmentreplacesBrowserAuthorizationFragmentwhen AuthTab is enabled and supported.SwitchBrowserActivitygains an AuthTab launch path alongside its existing Custom Tabs path.Both paths fall back to standard Custom Tabs when the browser doesn't support AuthTab.
Feature Flag
Create a new
ENABLE_AUTH_TABenum value inCommonFlight.java(common4j module) with config key"EnableAuthTab"and defaultfalse. Follow the pattern ofSWITCH_BROWSER_PROTOCOL_REQUIRES_STATE. Then gate all new behavior behindCommonFlightsManager.getFlightsProvider().isFlightEnabled(CommonFlight.ENABLE_AUTH_TAB).Technical Requirements
1. Feature Flag (common4j)
ENABLE_AUTH_TAB("EnableAuthTab", false)toCommonFlight.java2. Dependency Bump
browserVersion = "1.7.0"tobrowserVersion = "1.9.0"ingradle/versions.gradle3. New AuthTabAuthorizationFragment.kt (common)
common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/AuthorizationFragmentonCreate(), registerActivityResultLauncherviaAuthTabIntent.registerActivityResultLauncher(this, ::handleAuthResult)- MUST be before STARTED stateonResume(), buildAuthTabIntent.Builder().build()and callauthTabIntent.launch(launcher, uri, redirectScheme)requestUrlandredirectSchemefrom fragment arguments (same pattern asBrowserAuthorizationFragmentgetsmAuthIntent)AuthResult: RESULT_OK ->sendResult(RawAuthorizationResult.fromRedirectUri(...)), RESULT_CANCELED ->cancelAuthorization(true), RESULT_VERIFICATION_FAILED/TIMED_OUT -> send exception resultis_auth_tab_used,auth_tab_result_code,auth_tab_supportedLoggerclassonSaveInstanceState/extractStateforauthFlowStartedflag4. Update AuthorizationActivityFactory.kt
getAuthorizationFragmentFromStartIntent(), when agent is NOT WEBVIEW, checkCommonFlight.ENABLE_AUTH_TAB. If true, returnAuthTabAuthorizationFragment()5. Update SwitchBrowserActivity.kt
launchBrowser(), before existing Custom Tabs check: if AuthTab flag on +CustomTabsClient.isAuthTabSupported()returns true, launch viaAuthTabIntentActivityResultLauncherinonCreate()(must be before onStart)WebViewAuthorizationFragment.setSwitchBrowserBundle()+finishAndRemoveTask(); cancel/error ->finishAndRemoveTask()6. Add isAuthTabSupported() to CustomTabsManager.java
public static boolean isAuthTabSupported(@NonNull Context context, @NonNull String browserPackage)CustomTabsClient.isAuthTabSupported()with null-safety and loggingFiles to Modify/Create
common4j/src/main/com/microsoft/identity/common/java/flighting/CommonFlight.java- Add ENABLE_AUTH_TAB enumgradle/versions.gradle- browserVersion = "1.9.0"common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/AuthTabAuthorizationFragment.kt- NEW: AuthTab authorization fragmentcommon/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/AuthorizationActivityFactory.kt- Add AuthTab branchcommon/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/SwitchBrowserActivity.kt- Add AuthTab launch pathcommon/src/main/java/com/microsoft/identity/common/internal/ui/browser/CustomTabsManager.java- Add isAuthTabSupported()common/src/test/java/com/microsoft/identity/common/internal/providers/oauth2/AuthTabAuthorizationFragmentTest.kt- NEW: Unit testscommon/src/test/java/com/microsoft/identity/common/internal/providers/oauth2/AuthorizationActivityFactoryTest.java- Add AuthTab testsAcceptance Criteria
CommonFlight.ENABLE_AUTH_TABexists w...✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.