How to solve "No compatible browser found" error in Okta login?

Viewed 427

While trying to login into the OKTA login page, the android device is giving this error, And the login fails.

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

Dependencies used for Okta OIDC

implementation 'com.okta.authn.sdk:okta-authn-sdk-api:1.0.0'
implementation('com.okta.authn.sdk:okta-authn-sdk-impl:1.0.0') {
    exclude group: 'com.okta.sdk', module: 'okta-sdk-httpclient'
}
implementation 'com.okta.android:oidc-androidx:1.0.11'

The browser used is the default browser for the device. (Vivo browser) All permissions are given.

2 Answers

You need to set Chrome as your default browser.

Steps to follow:

  1. Go to settings on your device.
  2. Go to Permission management.
  3. Go to Default app settings.
  4. Go to Browser.
  5. Select application: Chrome. Now, your default browser is set to Chrome.
  6. Rerun the app and try login again.

enter image description here

The accepted answer won't work if you're developing an app targeting Android 11 (API 30) or higher.

Because of Package Visibility Filtering

In order to see packages that support custom tabs (which is what the Okta SDK is looking for), you have to declare a query in your manifest. This one works for me:

 <queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="http" />
    </intent>
</queries>
Related