Android Capture OpenID Connect (OIDC) not working on Samsung devices

Hello everyone,

OIDC seems not to be working on Samsung devices in Android Capture app v2.4.3. After the configuration of OIDC in a clone of the Android Capture app v2.4.3 as described in the wiki, and rebuilding the app, the OIDC button fails to respond when clicked on a Samsung device. Further investigation in logcat and flipper revealed the error below is thrown whenever the OIDC button is clicked:

2021-11-10 11:04:36.919 3523-3523/com.dhis2.debug E/LoginPresenter$openIdLogin - 231: android.content.ActivityNotFoundException
        at net.openid.appauth.AuthorizationService.prepareAuthorizationRequestIntent(AuthorizationService.java:372)
        at net.openid.appauth.AuthorizationService.getAuthorizationRequestIntent(AuthorizationService.java:267)
        at net.openid.appauth.AuthorizationService.getAuthorizationRequestIntent(AuthorizationService.java:296)
        at org.hisp.dhis.android.core.user.openid.OpenIDConnectHandlerImpl$logIn$1.apply(OpenIDConnectHandlerImpl.kt:54)
        at org.hisp.dhis.android.core.user.openid.OpenIDConnectHandlerImpl$logIn$1.apply(OpenIDConnectHandlerImpl.kt:45)
        at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:57)
        at io.reactivex.internal.operators.single.SingleMap$MapSingleObserver.onSuccess(SingleMap.java:64)
        at io.reactivex.internal.operators.single.SingleCreate$Emitter.onSuccess(SingleCreate.java:67)
        at org.hisp.dhis.android.core.user.openid.OpenIDConnectRequestHelper$discoverAuthConfig$1$1.onFetchConfigurationCompleted(OpenIDConnectRequestHelper.kt:55)
        at net.openid.appauth.AuthorizationServiceConfiguration$ConfigurationRetrievalAsyncTask.onPostExecute(AuthorizationServiceConfiguration.java:364)
        at net.openid.appauth.AuthorizationServiceConfiguration$ConfigurationRetrievalAsyncTask.onPostExecute(AuthorizationServiceConfiguration.java:305)
        at android.os.AsyncTask.finish(AsyncTask.java:771)
        at android.os.AsyncTask.access$900(AsyncTask.java:199)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:246)
        at android.app.ActivityThread.main(ActivityThread.java:8506)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

This was tested on Samsung Tab A, Samsung Galaxy A71, Motorola E4 Plus and Android emulator, however it only works on the Android emulator and the Motorola device while Samsung devices trigger the error above.

We tried setting Chrome as the default browser on the Samsung devices, however this doesn’t seem to improve the experience. Further digging around revealed that a similar issue was reported awhile back on the Openid AppAuth Android library.

Any ideas on how to get around this?

Thank you.

2 Likes

Hello Babatunde,

Thanks for reporting this. I have tested it in another Android device (Tecno Spark 7 with android 11).
It’s was not working. It looks like the issue is related to the android version.
In my research I found this Changes needed when targetting SDK 30+ · Issue #599 · openid/AppAuth-Android · GitHub

Blockquote
The new package visibility changes in Android 11 means that all of the queryIntentActivities() call BrowserSelector.java is broken.
As per the docs, the following should be added to your app’s manifest when targeting SDK 30 and above:

<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" />
    </intent>

    <intent>
        <action android:name="android.support.customtabs.action.CustomTabsService" />
    </intent>
</queries>

Let’s explore it.

3 Likes

Hello @diallotafsir52,

Will explore that and let you know how it goes.

Thanks.

Hello @diallotafsir52,

Happy to announce that the proposed fix works.

Thanks for your help.

2 Likes