xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.53k stars 505 forks source link

WebAuthenticator -> WebAuthentciationSession Code=3 #2082

Open rdebault opened 1 year ago

rdebault commented 1 year ago

Bug report best practices: Submitting Issues

Description

Using Xamarin.Essentials.Webauthenticator After deploying the application in Release the application executes on the first run, sometimes, and on subsequent executions it always generates this error:

 "Error Domain=com.apple.AuthentciationServices.WebAuthentciationSession Code=3" The UIWindowScene for the returned window was not in the foreground active state.".

The strange thing is that if I close my app, then open a web browser and browse a website my app will open as intended. The application runs the login process automatically when it is started. If I force the user to click on a Login Button to execute the login process it works fine. I have tried different linking options, delaying the automatic execution and forcing garbage collection. This does not happen when I run the application in Debug or adhoc mode.

Steps to Reproduce

  1. Execute the WebAuthenticator on application finished loading or OnAppearing
  2. If it works the first time close the app and then attempt to reopen it.

Expected Behavior

The App should always open and display the Authentication Screen

Actual Behavior

The WebAuthenticator component is throwing the error listed above

Basic Information

Screenshots

Reproduction Link