Issue with Essentials.WebAuthenticator and multiple activities #22017
Labels
area-essentials
Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info
platform/android 🤖
t/bug
Something isn't working
Description
Hello,
I'd like to report an issue that I've encountered while using WebAuthenticator from the MAUI Essentials.
In order to open the link in the CustomTabs on Android, WebAuthenticator uses the CustomTabsActivityManager from the Xamarin.AndroidX.Browser nuget. Method CustomTabsActivityManager.From contains the following code:
Due to the static instance field of the manager, it forever holds the reference to the activity that was passed with the first call to that method. The problem happens when this activity was destroyed, and then the app tries to call WebAuthenticator again. CustomTabsActivityManager still holds the reference to the Activity that is no longer in use, and then WebAuthenticator fails to use CustomTabs and fallbacks to the default browser.
I've created a repo where you can reproduce the issue.
Also this issue was discussed in this issue in the Xamarin/AndroidX repository, and as the result of that, the
From
method was marked as obsolete.Steps to Reproduce
Expected result: link is still opened in the CustomTabs
Actual result: user is redirected to the browser app, CustomTabs are not open
Link to public reproduction project repository
https://github.com/koviant/DroidWebAuthRepro
Version with bug
8.0.20 SR4
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: