Skip to content

WebAuthenticator on Windows throws unhelpful errors #23616

@dotMorten

Description

@dotMorten

Description

The WebAuthenticator APIs is not supported on Windows.
However, it has the entire old UWP implementation left in place, which gives a terrible and misleading developer experience.

First, trying to use the API you're met with the following exception, leading you to think you should just configure your app right:
image

However adding this required protocol to the app manifest, now just gives you a completely useless COMException:
image

There's no indication that this is just not supported.
Instead a PlatformNotSupportedException should be thrown with a helpful message leading people to a solution. Also the API should be tagged with a NotSupportedPlatform attribute.

I've now dealt with multiple customers who got stuck on this, and didn't know how to get it to work, and having to explain to them that it will never work.

Related to #2702

Steps to Reproduce

Use the WebAuthenticator.AuthenticateAsync API on Windows.

Link to public reproduction project repository

No response

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No, but you could use WinUIEx as an alternative API. The problem is though that the exception doesn't lead you to start looking for alternatives.

It does look like you can create your own IWebAuthenticator but it doesn't look like there's any way to register it. There are 0 references to this method so I don't see a way to do it:

internal static void SetDefault(IWebAuthenticator? implementation) =>

Otherwise that would be a somewhat OK place for people to register an alternative method to call, so the public webauthenticator api could become functional with a 3rd party library registered.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions