withAuthTab() fails with HTTPS (App Links) callbacks because CustomTabsController calls the custom-scheme AuthTabIntent.launch() overload
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- authentication, mobile
Hướng nghiên cứu
Read CustomTabsController.launchAsAuthTab() and the Auth Tab API usage in LogoutManager; compare how the SDK handles custom-scheme redirects with the documented HTTPS overload. Trace the existing Auth Tab tests and add coverage for HTTPS host and path handling in both login and logout. Done means HTTPS App Links deliver the callback successfully while custom-scheme redirects continue to work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Checklist
- The issue can be reproduced in the Auth0.Android sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
When using WebAuthProvider.login(account).withScheme("https").withAuthTab(), authentication fails to return credentials to the app after the user completes login in the Auth Tab, and instead fails with a0.authentication_canceled ("The user closed the browser app and the authentication was canceled.").
According to examples/auth-tab.md, Auth Tab supports both custom URI schemes and HTTPS (Android App Links) redirects verified through Digital Asset Links.
However, in CustomTabsController.launchAsAuthTab(), the SDK extracts only scheme and unconditionally calls the 3-argument custom-scheme overload of AuthTabIntent.launch():
String scheme = Uri.parse(redirectUri).getScheme();
AuthTabIntent authTabIntent = builder.build();
threadSwitcher.mainThread(() -> authTabIntent.launch(authTabLauncher, uri, scheme));
In androidx.browser:browser:1.10.0, AuthTabIntent has two distinct launch() overloads:
1. launch(launcher, uri, redirectScheme) — sets EXTRA_REDIRECT_SCHEME (must only be used for custom schemes).
2. launch(launcher, uri, redirectHost, redirectPath) — sets EXTRA_HTTPS_REDIRECT_HOST and EXTRA_HTTPS_REDIRECT_PATH (required for https redirects).
Because EXTRA_HTTPS_REDIRECT_HOST and EXTRA_HTTPS_REDIRECT_PATH are never set when scheme is "https", Chrome’s AuthTabIntentDataProvider / AuthTabVerifier does not recognize the HTTPS callback URL as the Auth Tab redirect target:
- Chrome’s
AuthTabVerifier.isCustomScheme(url)returns false because https is a standard web scheme(UrlUtilities.isAcceptedScheme(url) == true). - Chrome’s
AuthTabVerifier.shouldRedirectHttpsAuthUrl(url)returns false becauseEXTRA_HTTPS_REDIRECT_HOSTandEXTRA_HTTPS_REDIRECT_PATHwere null. - Instead of finishing the Auth Tab via
setResult(RESULT_OK, intent), Chrome falls through to standard Android App Links handling and startsRedirectActivity. RedirectActivitystarts AuthenticationActivity withFLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP, which force-finishes the child Auth Tab activity on top ofAuthenticationActivity.- Android delivers
RESULT_CANCELEDtoAuthenticationActivity'sauthTabLauncherbeforeonResume(), causingAuthTabResultHandlerto deliver a cancellationresult (Intent())and callfinish(), dropping the redirect data fromRedirectActivity.
Expected behavior: When the parsed redirectUri has scheme "https", CustomTabsController.launchAsAuthTab() (and LogoutManager when using returnTo) should extract host and path from redirectUri and call the 4-argument overload:
Uri parsedRedirect = Uri.parse(redirectUri);
String scheme = parsedRedirect.getScheme();
if ("https".equalsIgnoreCase(scheme)) {
String host = parsedRedirect.getHost();
String path = parsedRedirect.getPath();
// validate host and path are non-empty, then:
threadSwitcher.mainThread(() -> authTabIntent.launch(authTabLauncher, uri, host, path));
} else {
threadSwitcher.mainThread(() -> authTabIntent.launch(authTabLauncher, uri, scheme));
}
Reproduction
Consistently reproducible (100% of attempts):
-
Configure an Android app with verified HTTPS Android App Links (autoVerify="true" on RedirectActivity, matching assetlinks.json verified on-device via adb shell pm get-app-links).
-
Start login with Auth Tab and HTTPS scheme:
WebAuthProvider.login(account)
.withScheme("https")
.withAuthTab()
.withEphemeralBrowsing()
.await(activity)
- Complete sign-in on Universal Login inside the Chrome Auth Tab.
- Observe that when Auth0 redirects to https:///android//callback?code=..., RedirectActivity is launched instead of
authTabLauncherreceivingRESULT_OK, andWebAuthProviderthrowsAuthenticationExceptionwithisCanceled == true (a0.authentication_canceled).
Additional context
-
Dependencies: com.auth0.android:auth0:4.3.0, androidx.browser:browser:1.10.0
-
Browser: Chrome 156 (also affects Chrome 137+)
-
Removing .withAuthTab() (using standard Custom Tabs with the exact same HTTPS App Link configuration) succeeds immediately.
-
Also confirmed present on main and v5_development (5.0.0-beta.2).
Auth0.Android version:4.3.0(also affects4.0.0-beta.1through5.0.0-beta.2)
Android version(s): Android 13 (API 33), Samsung SM-G991U (reproduces on any Android 12+ device with Chrome 137+)
Auth0.Android version
4.3.0
Android version(s)
13-17
- Ngôn ngữ chính
- Kotlin
- Star
- 303
- Fork
- 182
- Merge trung bình
- 18 giờ 42 phút
- Pull request đã merge (30 ngày)
- 36
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của auth0/Auth0.Android
-
feature request
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
auth0/Auth0.Android#1136 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
auth0/Auth0.Android#1127 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SecureCredentialsManager serves expired access tokens for up to an hour after the autumn DST transitionCó thể đã có người làm @utkrishtsahu đã nhận 15 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
auth0/Auth0.Android#1113 · 1 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
auth0/Auth0.Android#1093 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của auth0/Auth0.Android
Issue tương tự
-
hoglite
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Android: with view recycling on, a recycled View keeps its nextFocusLeftCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởNeeds: Triage :mag: Platform: Android
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
react/react-native#60167 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ankidroid/Anki-Android#23557 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CI/CD ⚒️ Flaky-tests 🐦 python 🐍
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
valkey-io/valkey-glide#7804 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày