Closed merijndejonge closed 3 years ago
Hi @merijndejonge This usually means your device doesn't have chrome installed. If it is then it might not be set as the default browser on your device. What device are you testing on?
I'm running on an android-one device (Nokia 7 plus). So Chrome is definitely installed and is also the default browser. The okta client is working as expected as I start my app by hand. But if it is started through the autofill API this issue occurs. So it should be something else.
Hi @merijndejonge Are you starting the auth flow in the context of the autofill service? or in the context of the activity? I have not tried using the autofill service to start but if you are starting the flow in the autofill service then could the service have been disconnected? I'm guessing it can happen when autofill is complete. You can use the event log and see what your autofill service is doing by using adb logcat -b events
https://developer.android.com/studio/command-line/logcat#alternativeBuffers
Hi @FeiChen-okta, I'm creating an authIntent in the autofill service to pass control to my MinaActivity in which I initiated the auth flow:
val authIntent = Intent(this, MainActivity::class.java).apply {
// Send any additional data required to complete the request.
}
This is according to the documentation https://developer.android.com/guide/topics/text/autofill-services?hl=en#kotlin The, in the onStart of my MainActivity I trigger the authflow:
lifecycleScope.launch {
identityManager.signIn(this@MainActivity)
}
This signIn method will call the okta signing code:
suspendCoroutine<AuthorizationStatus> {
val payload = AuthenticationPayload.Builder().build()
webAuth.registerCallback(webAuthCallBack(it), activity)
webAuth.signIn(activity, payload)
}
So, everything runs in the MainActivity, right?
Hi @merijndejonge When starting by hand are you also using the following?
lifecycleScope.launch {
identityManager.signIn(this@MainActivity)
}
My guess is that the lifecycleScope
might be causing the issue. Since webAuth.signIn
starts a new activity, MainActivity can be destroyed during the auth flow. Try calling webAuth.signIn
without coroutine. So in onStart or onCreate you can try calling:
val payload = AuthenticationPayload.Builder().build()
webAuth.registerCallback(webAuthCallBack(it), activity)
webAuth.signIn(activity, payload)
Yes, I'm using the exact same code.
Anyway, I removed the coroutine code and replaced it with the normal callback way of working. Then I fixed a couple of other issues, it seems to work now. But it all feels a bit fragile. I had a hard time to get everything to work including logout->login flow. Would be nice to see a coroutine implementation of okta appear in the future :-)
Thanks for your help!
Unfortunately, the problem still exists. I've completely rewritten the code for authentication. But the same error occurs. I'm nog using adb as you suggested. before the crash, and before all the okta stuff is happening such as OktaRedirectActivity, I see the following line:
am_on_paused_called: [0,org.chromium.chrome.browser.customtabs.CustomTabActivity,performPause]
Then a lot of (okta) stuff happens but this chrome activity is not resumed. Then, the app crashes:
am_crash: [25999,0,myapp.app,552124230,android.content.ActivityNotFoundException,No Activity found to handle Intent { act=android.intent.action.VIEW pkg=com.android.chrome (has extras) },Instrumentation.java,2007]
`myapp.app' is my app.
Any idea what is going on, and how to solve this?
Hi @merijndejonge From the logs it looks like chrome has started and stopped. This might be due to an invalid uri. How are you passing in the authorize
endpoint? Are you using the discovery_uri or CustomConfiguration?
Hi @FeiChen-okta , I'm using the discovery_uri. And everything is working if I don't use the autofill API. Also, the exception is raised after I logged in. So, in steps:
If you wish, I can give you a stripped-down version of my app that demonstrates the issue.
Hi @FeiChen-okta I have the same issue in my project.
Environment
Hello @bedirguven,
Can you tell me a little more about the device on which you see this issue? Can you confirm that Chrome is installed?
Thanks
Hi @bedirguven
Have you set taskAffinity property in AndroidManifest.xml of your project?
P.S.: try to assembly library from this PR https://github.com/okta/okta-oidc-android/pull/175
Thanks
Can anyone still reproduce this with the latest SDK?
cc @bedirguven @merijndejonge
I'm experiencing the same issue with the latest version of the SDK. This only happens when I'm coming back in my application from the signin verify account link.
Chrome is correctly installed and we are seeing this on multiple type of devices in production with our newly released application.
Hi @FeiChen-okta I have the same issue in my project.
Environment
- SDK Version: com.okta.android:oidc-androidx:1.0.14
any update on this?
Same issue here. all crashes happening with Galaxy devices. Okta version 1.0.16
@lucianoeli react-native users had similar problem https://github.com/okta/okta-react-native/pull/81, you can try using browser matchAll flag when using WebAuthBuilder
@lucianoeli react-native users had similar problem okta/okta-react-native#81, you can try using browser matchAll flag when using WebAuthBuilder
thanks for the response. i try that but i´m still getting the crash :/
Seems related to https://github.com/okta/okta-oidc-android/issues?q=is%3Aissue+https%3A%2F%2Fgithub.com%2Fopenid%2FAppAuth-Android%2Fissues%2F157
Were any considerations made in the new okta-oidc-android library as it replaced the old appauth-android library, where the appauth-android library had addressed Samsung SBrowser related issues?
@lucianoeli react-native users had similar problem okta/okta-react-native#81, you can try using browser matchAll flag when using WebAuthBuilder
Hi everyone, We are also experiencing this issue and Okta support advised us on this solution as well, but it did not fix the issue.
Hi @redaAazNJ run this command to see if the deice show any app that supports chrome custom tabs
adb shell pm query-services -a android.support.customtabs.action.CustomTabsService
If you have a chrome custom tab enabled browser installed it should show:
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=0x7f1301a4 nonLocalizedLabel=null icon=0x7f080233 banner=0x0
className=org.chromium.chrome.browser.base.SplitChromeApplication
processName=com.android.chrome
taskAffinity=com.android.chrome
uid=10173 flags=0xa0cbbec5 privateFlags=0x84089100 theme=0x0
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
sourceDir=/data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/base.apk
splitSourceDirs=[/data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_autofill_assistant.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_chime.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_chrome.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_config.en.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_dev_ui.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_extra_icu.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_feedv2.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_image_editor.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_stack_unwinder.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_test_dummy.apk, /data/app/~~jWWtoB9QVyrAwViEd8rVgg==/com.android.chrome-xI3QHKToJ_k0gu60Ln0l7g==/split_vr.apk]
resourceDirs=[/product/overlay/NavigationBarModeGestural/NavigationBarModeGesturalOverlay.apk]
seinfo=google:targetSdkVersion=30
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/~~_mYIBta3MM91_J752_B5Kw==/com.google.android.trichromelibrary_447207733-fGcpBxNvzJ2jc1mlUX7K5Q==/base.apk]
splitClassLoaderNames=[null, null, null, null, null, null, null, null, null, null, null]
enabled=true minSdkVersion=29 targetSdkVersion=30 versionCode=447207733 targetSandboxVersion=1
manageSpaceActivityName=org.chromium.chrome.browser.site_settings.ManageSpaceActivity
supportsRtl=true
fullBackupContent=true
crossProfile=false
networkSecurityConfigRes=0x7f170020
category=4
HiddenApiEnforcementPolicy=2
usesNonSdkApi=false
allowsPlaybackCapture=false
Service #1:
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
ServiceInfo:
name=org.mozilla.fenix.customtabs.CustomTabsService
packageName=org.mozilla.firefox
enabled=true exported=true directBootAware=false
permission=null
flags=0x0
ApplicationInfo:
name=org.mozilla.fenix.MigratingFenixApplication
packageName=org.mozilla.firefox
labelRes=0x7f130039 nonLocalizedLabel=null icon=0x7f0f0003 banner=0x0
className=org.mozilla.fenix.MigratingFenixApplication
processName=org.mozilla.firefox
taskAffinity=org.mozilla.firefox
uid=10219 flags=0x38c83e44 privateFlags=0xac001110 theme=0x7f140130
requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0
sourceDir=/data/app/~~JCNYeR_JYkFGQBNcEJ1tXA==/org.mozilla.firefox-TeV4f1EboWgx5mFcl4_y2Q==/base.apk
resourceDirs=[/product/overlay/NavigationBarModeGestural/NavigationBarModeGesturalOverlay.apk]
seinfo=default:targetSdkVersion=29
seinfoUser=:complete
dataDir=/data/user/0/org.mozilla.firefox
deviceProtectedDataDir=/data/user_de/0/org.mozilla.firefox
credentialProtectedDataDir=/data/user/0/org.mozilla.firefox
sharedLibraryFiles=[/system/framework/android.test.base.jar]
enabled=true minSdkVersion=21 targetSdkVersion=29 versionCode=2015811035 targetSandboxVersion=1
supportsRtl=true
fullBackupContent=true
crossProfile=false
category=4
HiddenApiEnforcementPolicy=2
usesNonSdkApi=false
allowsPlaybackCapture=true
Hi @FeiChen-okta, Thank you for your answer.
As you can see the chrome custom tabs are enabled in our devices:
1 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=0x7f1301a4 nonLocalizedLabel=null icon=0x7f080232 banner=0x0 className=org.chromium.chrome.browser.base.SplitChromeApplication processName=com.android.chrome taskAffinity=com.android.chrome uid=10224 flags=0xa0cbbec5 privateFlags=0x4089100 theme=0x0 requiresSmallestWidthDp=0 compatibleWidthLimitDp=0 largestWidthLimitDp=0 sourceDir=/data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/base.apk splitSourceDirs=[/data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_autofill_assistant.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_chime.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_chrome.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_config.fr.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_dev_ui.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_extra_icu.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_feedv2.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_image_editor.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_stack_unwinder.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_test_dummy.apk, /data/app/com.android.chrome-L6E-ufTLOH0yMHdoWMTqvg==/split_vr.apk] seinfo=chrome:targetSdkVersion=30 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_447208833-tzgQC3lsZhVHU_7eC6AKfQ==/base.apk] splitClassLoaderNames=[null, null, null, null, null, null, null, null, null, null, null] enabled=true minSdkVersion=29 targetSdkVersion=30 versionCode=447208833 targetSandboxVersion=1 manageSpaceActivityName=org.chromium.chrome.browser.site_settings.ManageSpaceActivity supportsRtl=true fullBackupContent=true networkSecurityConfigRes=0x7f170020 category=4 HiddenApiEnforcementPolicy=2 usesNonSdkApi=false allowsPlaybackCapture=false
In addition theses crashes are not systematic. The user may or may not experience this issue without changing the device.
Hi @redaAazNJ Is that device managed? If it is then chrome has to be installed on the work profile same as the app using the SDK.
Hi @redaAazNJ, do you have any updates for us?
Hi everyone, Yes, our users have devices with work profile but we have already checked that chrome and our application are installed on the work profile.
But as I said, this crash doesn't appear all the time, If it was related to chrome installation it should never show the login page, right?
Hu, I'm using okta client on android for oidc authentication. I'm integrating the authentication flow in an autofill service. The authflow is triggered from the Minaactivity of my app. The app implements to autofill API of Android. When the MainActivity that triggers the authentication flow is started from within the autofill service I get the following exception:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW pkg=com.android.chrome (has extras) } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2057) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1711) at android.app.Activity.startActivityForResult(Activity.java:5192) at android.app.Activity.startActivityForResult(Activity.java:5150) at android.app.Activity.startActivity(Activity.java:5521) at android.app.Activity.startActivity(Activity.java:5489) **at com.okta.oidc.OktaAuthenticationActivity$1.onCustomTabsServiceConnected(OktaAuthenticationActivity.java:275)** at androidx.browser.customtabs.CustomTabsServiceConnection.onServiceConnected(CustomTabsServiceConnection.java:57) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1948) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1980) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Apparently, something in onCustomTabsServiceConnected goes wrong. It seems that 'startActivity(createBrowserIntent(browserPackage, session));' in the method is causing the exception.
As I'm not an android expert, I've no clue what I'm doing wrong.
Any help is greatly appreciated.