Closed Qwin closed 2 years ago
@Qwin is this related to https://github.com/okta/okta-oidc-android/issues/247
Do you have more information like a stack trace?
it actually shows mSupportedBrowsers as null and there is no crash or anything just does nothing, my guess based on the code I saw is that SyncWebAuthClientImpl.java, tries to open the browser and waits forever, because if I try to login again, it throws first a interrupted exception and then tries again to open browser.
Not sure why my pocophone or some android devices will not provide the browser id, as seen from the post above, the person even tried to manually provide the id but that didnt help either.
@JayNewstrom checking now the issue you provided seeing if its the same
UPDATE 1: I think it might be a slightly different issue based on the description that I read.
UPDATE 2: Note that the device does have the latest Chrome browser installed
@Qwin Can you run the following commands to see if a compatible browser is installed:
adb shell pm query-activities -a android.intent.action.VIEW -d "https://www.example.com"
adb shell pm query-services -a android.support.customtabs.action.CustomTabsService
If the query-services doesn't show any compatible custom tabs service then that device doesn't have a compatible browser.
@FeiChen-okta will try :)
Here we go:
1 activities found:
Activity #0:
priority=0 preferredOrder=0 match=0x208000 specificIndex=-1 isDefault=true
ActivityInfo:
name=com.android.browser.LauncherActivity
packageName=com.mi.globalbrowser
enabled=true exported=true directBootAware=false
taskAffinity=null targetActivity=null persistableMode=PERSIST_ROOT_ONLY
launchMode=0 flags=0x301220 privateFlags=0x0 theme=0x7f140361
screenOrientation=-1 configChanges=0x1fb3 softInputMode=0x0
lockTaskLaunchMode=LOCK_TASK_LAUNCH_MODE_DEFAULT
resizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDK_VERSION
ApplicationInfo:
name=com.android.browser.Browser
packageName=com.mi.globalbrowser
labelRes=0x7f1303dc nonLocalizedLabel=null icon=0x7f100028 banner=0x0
className=com.android.browser.Browser
processName=com.mi.globalbrowser
taskAffinity=com.mi.globalbrowser
uid=10231 flags=0x30d83ec5 privateFlags=0x2c101118 theme=0x0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
sourceDir=/data/app/com.mi.globalbrowser-72d38_40z1h9Resnx8cOWA==/base.apk
seinfo=platform:privapp:targetSdkVersion=29
seinfoUser=:complete
dataDir=/data/user/0/com.mi.globalbrowser
deviceProtectedDataDir=/data/user_de/0/com.mi.globalbrowser
credentialProtectedDataDir=/data/user/0/com.mi.globalbrowser
enabled=true minSdkVersion=21 targetSdkVersion=29 versionCode=202110116 targetSandboxVersion=1
supportsRtl=true
fullBackupContent=true
networkSecurityConfigRes=0x7f160007
category=7
HiddenApiEnforcementPolicy=0
usesNonSdkApi=false
allowsPlaybackCapture=true
2 services found:
Service #0:
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
ServiceInfo:
name=org.chromium.chrome.browser.customtabs.CustomTabsConnectionService
packageName=com.android.chrome
splitName=chrome
enabled=true exported=true directBootAware=false
permission=null
flags=0x0
ApplicationInfo:
name=org.chromium.chrome.browser.base.SplitChromeApplication
packageName=com.android.chrome
labelRes=0x7f1301d8 nonLocalizedLabel=null icon=0x7f080238 banner=0x0
className=org.chromium.chrome.browser.base.SplitChromeApplication
processName=com.android.chrome
taskAffinity=com.android.chrome
uid=10084 flags=0xa0cbbec5 privateFlags=0x4089100 theme=0x0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
sourceDir=/data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/base.apk
splitSourceDirs=[/data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_autofill_assistant.apk, /data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_chime.apk, /data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_chrome.apk, /data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_config.en.apk, /data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_extra_icu.apk, /data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_feedv2.apk, /data/app/com.android.chrome-zg2OtSTN0hdnX_-Yvdg9yg==/split_image_editor.apk]
seinfo=default:targetSdkVersion=31
seinfoUser=:complete
dataDir=/data/user/0/com.android.chrome
deviceProtectedDataDir=/data/user_de/0/com.android.chrome
credentialProtectedDataDir=/data/user/0/com.android.chrome
sharedLibraryFiles=[/data/app/com.google.android.trichromelibrary_460607133-002zisZXu4xz0esJTD2K7w==/base.apk]
splitClassLoaderNames=[null, null, null, null, null, null, null]
enabled=true minSdkVersion=29 targetSdkVersion=31 versionCode=460607133 targetSandboxVersion=1
manageSpaceActivityName=org.chromium.chrome.browser.site_settings.ManageSpaceActivity
supportsRtl=true
fullBackupContent=true
networkSecurityConfigRes=0x7f170023
category=4
HiddenApiEnforcementPolicy=2
usesNonSdkApi=false
allowsPlaybackCapture=false
Service #1:
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
ServiceInfo:
name=org.chromium.chrome.browser.customtabs.CustomTabsConnectionService
packageName=com.microsoft.emmx
enabled=true exported=true directBootAware=false
permission=null
flags=0x0
ApplicationInfo:
name=org.chromium.chrome.browser.ChromeApplication
packageName=com.microsoft.emmx
labelRes=0x7f130233 nonLocalizedLabel=null icon=0x7f100000 banner=0x0
className=org.chromium.chrome.browser.ChromeApplication
processName=com.microsoft.emmx
taskAffinity=com.microsoft.emmx
uid=10253 flags=0x38c83e44 privateFlags=0xc001010 theme=0x0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
sourceDir=/data/app/com.microsoft.emmx-X_R_l1dG08hDpLstFmS56g==/base.apk
seinfo=default:targetSdkVersion=29
seinfoUser=:complete
dataDir=/data/user/0/com.microsoft.emmx
deviceProtectedDataDir=/data/user_de/0/com.microsoft.emmx
credentialProtectedDataDir=/data/user/0/com.microsoft.emmx
enabled=true minSdkVersion=19 targetSdkVersion=29 versionCode=5147004 targetSandboxVersion=1
manageSpaceActivityName=org.chromium.chrome.browser.preferences.website.ManageSpaceActivity
supportsRtl=true
fullBackupContent=true
networkSecurityConfigRes=0x7f170029
HiddenApiEnforcementPolicy=2
usesNonSdkApi=false
allowsPlaybackCapture=true
Seems like CustomTabs services are available on 2 browsers. My guess one is MI and the other is the Chrome browser.
looks like the cct services is microsoft edge browser com.microsoft.emmx
and chrome.
But the MI browser does not support CCT. The activity found is only the MI browser:
name=com.android.browser.LauncherActivity
packageName=com.mi.globalbrowser
You can try adding the chrome or edge browser packaged in the supported browser and add the match all flag like
.supportedBrowsers("com.microsoft.emmx")
.browserMatchAll(true)
@FeiChen-okta ok will try it out
@FeiChen-okta woot thank you! it works with browserMatchAll to true! (no need for manually adding the supportedBrowsers) makes sense it basically matched the others that are supported I guess.
Now this begs the question why not have browserMatchAll always enabled and can be disabled (so default to true ?)
Match default should work but it doesn't. This is only an issue with browser queries according to googles own samples:
We didn't set the default to true cause the documentation says: https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_ALL
This flag should be used with extreme care.
@FeiChen-okta I wonder if we could implement something where when it fails to open the custom chrome tab, open in a webview or any other backup method. Also maybe bubbling up an error saying that there were no supported browsers and trying enabling the match all, might help save some.
We don't plan to implement a fallback in this SDK. But doing something along the lines of what you described is possible in the new SDK.
@Qwin @FeiChen-okta I face the same issue on my Xiaomi Redmi Note 3, and irrespective of adding the below code in the manifest it doesn't work. It works only when I set the flag browserMatchAll
to true but from the commentary above I understand that it should be used carefully. Not sure how I resolve this issue if that is the case.
Seems like this issue has been going around the okta forums, but I saw as well that this issue happens on some other phones. Not sure what the cause is but here is some more info about it, I am having the same issue. I do know the code that opens the browser is within this library which is used by the react-native okta library.
https://devforum.okta.com/t/okta-authentication-in-app-browser-within-app-not-working-on-android-pocophone/11547/3