okta / okta-oidc-android

OIDC SDK for Android
https://github.com/okta/okta-oidc-android
Other
59 stars 45 forks source link

Cannot sign in using WebAuthClient #254

Closed FabianShallari closed 3 years ago

FabianShallari commented 3 years ago

Hi!

I am trying to authenticate via using the web view however I get the following error:

com.okta.oidc D/MainActivity: onError: 
    AuthorizationException: {"type":0,"code":10,"errorDescription":"No compatible browser found"}

I am trying to do this on the kotlin-sign-in sample app:

webAuthClient = Okta.WebAuthBuilder()
            .withConfig(config)
            .withContext(this)
            .withStorage(SharedPreferenceStorage(this, PREF_STORAGE_WEB))
            .setRequireHardwareBackedKeyStore(hardwareKeystore)  // true or false has no effect
            .browserMatchAll(true) // true or false has no effect
            .create()

Tested on:

Device: OnePlus 8 Pro OS: Android 11 Browser apps: Chrome, Firefox Okta sdk version: 'com.okta.android:oidc-androidx:1.0.14'

Device: Emulator x86 OS: Android 11 Browser apps: Chrome (user account setup completed) Okta sdk version: 'com.okta.android:oidc-androidx:1.0.14'

Output from adb shell pm query-activities -a android.intent.action.VIEW -d "https://www.example.com": (OnePlus 8 Pro)

_1 activities found: Activity #0: priority=0 preferredOrder=0 match=0x208000 specificIndex=-1 isDefault=true ActivityInfo: name=com.google.android.apps.chrome.IntentDispatcher packageName=com.android.chrome splitName=chrome enabled=true exported=true directBootAware=false taskAffinity=null targetActivity=org.chromium.chrome.browser.document.ChromeLauncherActivity persistableMode=PERSIST_ROOT_ONLY launchMode=0 flags=0x301220 privateFlags=0x0 theme=0x7f14017b screenOrientation=-1 configChanges=0x1fb3 softInputMode=0x0 lockTaskLaunchMode=LOCK_TASK_LAUNCH_MODE_DEFAULT resizeMode=RESIZE_MODE_RESIZEABLE_VIA_SDKVERSION ApplicationInfo:

I can see that the OktaAuthenticationActivity#getBrowser() returns a 0 size result list on the following line:

List<ResolveInfo> resolveInfoList = pm.queryIntentActivities(browserIntent, mMatchFlag);

JayNewstrom commented 3 years ago

Hi @FabianShallari sorry to hear you're running into issues. I've tried this on 2 devices running Android 11(pixel 4a, and emulator), and I was able to log in successfully on both.

Could you give me a little bit more information about the devices you're running into issues with? What version of chrome are they using?

FabianShallari commented 3 years ago

Hello @JayNewstrom

Thanks a lot for your quick response.

The device I'm trying is a OnePlus 8 Pro running Android 11 with Chrome version 91.0.4472.164

JayNewstrom commented 3 years ago

Could you try and upgrade to the latest oidc-android sdk? https://github.com/okta/okta-oidc-android/releases Currently 1.0.20. This may be an issue we've already fixed.

FabianShallari commented 3 years ago

That fixed it! Thanks a lot @JayNewstrom !