AppAuth-Android: Android 14 Beta - AuthorizationManagementActivity fails to handle AuthIntent due to being recreated
Checklist:
- I am using the latest release
- I searched for existing GitHub issues
- I read the documentation
- I verified the client configuration matches the information in the identity provider (or I am using dynamic client registration)
- I am either using a custom URI scheme or
https
with App Links for client redirect.
Configuration
- Version: 0.11.1
- Integration: (native(Kotlin))
- Identity provider: (Google, Okta)
Issue Description
Hi There.
We have been using AppAuth for years now and only now we just had a problem on Android 14.
On API 34 the login flow is broken, after the startActivity()
from AuthorizationManagementActivity
is called and we finish the login flow instead of the same instance of AuthorizationManagementActivity
being updated to handle handleAuthorizationComplete
on the onResume
, a completely new instance is being created, and therefore fails to function properly.
We where able to get passed this issue by changing the launchMode of AuthorizationManagementActivity
from singleTask
to singleInstance
Here is a screenshot with some logs confirming that indeed a new instance of AuthorizationManagementActivity
is created.
And here is the same logs after changing the launchMode to singleInstance
<activity android:name=".AuthorizationManagementActivity"
android:exported="false"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboard|keyboardHidden"
android:theme="@style/Theme.AppCompat.Translucent.NoTitleBar"
android:launchMode="singleInstance" />
If there is any configuration that we might have missed to fix this we would appreciate if you could point us in the right direction, in case this is not actually an issue on your end.
Thank you
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19
I want actually to elaborate a bit on @troymolnar 's answer (and thank you for the idea by the way).
The trick is indeed in the launchMode of the openId activity, but to correct it make sure you replace with their whole thing:
Otherwise you lose the intent filter of RedirectUriReceiverActivity 😄
@agologan after further investigation the root of the issue comes from a google issue, and to replicate it with AppAuth the activity that calls AppAuth needs to be a
singleInstance
you can do it with setting int value in resources which you can latter use in AndroidManifest - just bare in mind that it’s not string then - it’s int - you can check values in Android source code
2 - LAUNCH_SINGLE_TASK - default 3 - LAUNCH_SINGLE_INSTANCE - fix for api 34
in AndroidManifest just add this:
and
values/integers.xml
and actual fix:
values-v34/integers.xml
Thanks for this interim solution! You saved my bacon 😃
Fyi who ever it helps, we’ve been in communication with Google about this issue for our own app, and they’re now claiming that their fix for the launchType will be released during QPR1 (which is currently in beta). That means that there may be up to 2-3 months of time (guessing based on last years Android 13 release pattern) between the production release of Android 14 & the fix.
We have a simple workaround for it in the meantime, though it comes with it’s own set of possibly unique drawbacks.
Overriding openId’s launch mode this way in our own manifest at least let’s us log in again.