flutter_appauth icon indicating copy to clipboard operation
flutter_appauth copied to clipboard

authorizeAndExchangeCode not returning on Android 14

Open guy-utila opened this issue 1 year ago • 6 comments

We have an app that is working well with flutter_appauth for a while (iOS and Android). Recently I upgraded my Android device to Android 14 and now it seems like I can not login (using Google), I get to see the Google account selection but after selecting the account the screen redirects to itself and hangs on the loading state.

All I get in the debug are these messages:

W/AppAuth ( 586): No stored state - unable to handle response W/iour.app.name( 586): Cleared Reference was only reachable from finalizer (only reported once)

To be clear - same code base has no issues when running in either iOS or Android 11.

Is there a know issue with Android 14?

guy-utila avatar Oct 12 '23 13:10 guy-utila

is there any update regarding this? This is a major issue.

debasmitasarkar avatar Oct 18 '23 07:10 debasmitasarkar

If you believe it's Android 14 related then you should be able to clone the repository and run the example app to confirm. I'm not in a position to check right now but have been running other apps using this library on Android 14 without issues. I suspect your issue is more to do with a change that Google brought about to authentication using their services https://developers.googleblog.com/2023/10/enhancing-oauth-app-impersonation-protections.html?m=1

MaikuB avatar Oct 19 '23 09:10 MaikuB

It seems like our issue is related to this one: https://github.com/openid/AppAuth-Android/issues/977 It is a bug in Android 14 and should be fixed. Methods of resolving the issue are proposed in the link.

guy-utila avatar Oct 23 '23 07:10 guy-utila

The interim solution mentioned in https://github.com/openid/AppAuth-Android/issues/977#issuecomment-1746881655 works for now:

        <activity
            android:name="net.openid.appauth.AuthorizationManagementActivity"
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
            android:exported="false"
            android:launchMode="singleInstance"
            android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar"
            tools:node="replace"/>
        <activity
            android:name="net.openid.appauth.RedirectUriReceiverActivity"
            android:exported="true"
            tools:node="replace">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="${appAuthRedirectScheme}" />
            </intent-filter>
        </activity>

praharshbhatt avatar Oct 26 '23 15:10 praharshbhatt

@praharshbhatt its work, but if u back to app first and back to auth, will be get loop. and the app gone.

any update, without change the launch mode to singleInstance ?

gabrielmulyawan avatar Dec 13 '23 05:12 gabrielmulyawan

Can confirm: Any subsequent request to the method returns null

snovak7 avatar May 17 '24 04:05 snovak7