Skip to content

fix: remove conflicting broad scheme from MainActivity to prevent Android disambiguation dialog#1514

Merged
subhankarmaiti merged 1 commit intomasterfrom
fix/android-duplicate-scheme-disambiguation
Apr 22, 2026
Merged

fix: remove conflicting broad scheme from MainActivity to prevent Android disambiguation dialog#1514
subhankarmaiti merged 1 commit intomasterfrom
fix/android-duplicate-scheme-disambiguation

Conversation

@subhankarmaiti
Copy link
Copy Markdown
Contributor

@subhankarmaiti subhankarmaiti commented Apr 22, 2026

Summary

  • When customScheme in the Auth0 plugin config matches the app's Expo scheme (e.g., both set to "smtest"), Android shows a chooser dialog during the Auth0 login callback because both MainActivity (broad scheme handler added by @expo/config-plugins) and RedirectActivity (specific Auth0 callback handler) are registered for the same URL scheme
  • The Expo plugin (addAndroidAuth0Manifest) now removes conflicting broad scheme data elements (same scheme, no android:host) from other activities before adding the Auth0-specific intent filter to RedirectActivity, mirroring the existing iOS deduplication logic in addIOSAuth0ConfigInInfoPList
  • Only broad matchers are removed — data elements with an android:host are preserved since they won't cause disambiguation

Root Cause

Expo's @expo/config-plugins adds <data android:scheme="smtest"/> to MainActivity for deep linking. The react-native-auth0 plugin then adds <data android:scheme="smtest" android:host="..." android:pathPrefix="..."/> to RedirectActivity. When Chrome Custom Tab redirects back after authentication, it finds two exported activities matching the scheme and shows a disambiguation dialog. iOS already handles this via dedup in addIOSAuth0ConfigInInfoPList. Android was missing the equivalent.

Test plan

  • Added test: conflicting broad scheme is removed from MainActivity
  • Added test: non-conflicting schemes on other activities are left untouched
  • Added test: scheme data with android:host (specific match) is preserved
  • Verify Auth0 login flow completes without disambiguation dialog on Android
  • Verify exp+<scheme> deep links still work in dev mode
  • Verify existing snapshot tests still pass

@subhankarmaiti subhankarmaiti requested a review from a team as a code owner April 22, 2026 13:30
@subhankarmaiti subhankarmaiti merged commit dc64bf7 into master Apr 22, 2026
4 checks passed
@subhankarmaiti subhankarmaiti deleted the fix/android-duplicate-scheme-disambiguation branch April 22, 2026 13:41
@subhankarmaiti subhankarmaiti mentioned this pull request Apr 23, 2026
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