dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

WebAuthenticator iOS/MacCatalyst uses Default Web Browser (rejected by App Store reviewer) #21872

Open tekmun opened 5 months ago

tekmun commented 5 months ago

Description

According to this website (https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/communication/authentication), iOS12 and higher uses ASWebAuthenticationSession, which should be Safari browser instead of the default web browser. Unfortunately, this is untrue. When I change the default web browser to another browser (eg. Firefox), the authentication session opens Firefox browser. I tried it with Facebook and Google sign-ins. Apple Sign-in has no issue because I use the AppleSignIn solution. The App Store Review rejects my app because it opens a default web browser instead of Safari.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

MacOS 14.4.1

Did you find any workaround?

No.

Relevant log output

No response

tekmun commented 5 months ago

In the code folder maui/src/Essentials/src/WebAuthenticator, there are two separate files for iOS/TVOS and macOS. The contents are quite different. Could this be the reason on macOS, the default web browser is used instead of "ASWebAuthenticationSession"?

tekmun commented 5 months ago

On line 73 in WebAuthenticator.ios.tvos.cs (https://github.com/dotnet/maui/blob/main/src/Essentials/src/WebAuthenticator/WebAuthenticator.ios.tvos.cs), there is an if condition. (OperatingSystem.IsIOSVersionAtLeast(12)) Could this be the reason why it does not open ASWebAuthenticationSession but the default browser on MacCatalyst?

tekmun commented 5 months ago

This bug is blocking my submission to the AppStore for MacCatalyst. This if statement (OperatingSystem.IsIOSVersionAtLeast(12)) may be blocking the MacCatalyst app from utilising ASWebAuthenticationSession. Can this conditional statement be expanded to include MacCatalyst in the next release?

tekmun commented 4 months ago

Is there an update on this bug? I am unable to submit my app to the Mac Store. Kindly help. Thanks.

mattleibow commented 4 months ago

I created this PR and will try and get the code compiling, but I have not tested anything yet: https://github.com/dotnet/maui/pull/22739

Once the build is complete, you should be able to test and let us know if it works as expected. Once we know, we can merge and it will appear in the releases.

mattleibow commented 4 months ago

@tekmun have you been able to test the artifacts from the PR?