IdentityModel.OidcClient.Samples icon indicating copy to clipboard operation
IdentityModel.OidcClient.Samples copied to clipboard

MAUI sample on Android crashes on login

Open MaTToX3 opened this issue 3 years ago • 3 comments

Getting the following error when trying to login with MAUI sample running on Android:

System.InvalidOperationException: 'You must subclass the WebAuthenticatorCallbackActivity and create an IntentFilter for it which matches your callbackUrl.'

image

It seems like something is still missing? That activity is implemented in Xamarin.Forms sample and it works, but here is missing, I believe on purpose? Has someone been able to login successfully on Android?

Thanks in advance.

MaTToX3 avatar Aug 30 '22 07:08 MaTToX3

You need to create a IntentFilter that responds to the callback url you define, which is specific per platform.

Check the Get Started on the Microsoft docs for Web Authenticator here: https://docs.microsoft.com/en-us/xamarin/essentials/web-authenticator

For MAUI, the instructions work for Android and iOS, but on UWP it's not working since it's still not yet supported: https://github.com/microsoft/WindowsAppSDK/issues/441

jrcpereira avatar Aug 30 '22 16:08 jrcpereira

I do not test against Android. Feel free to submit a PR if you have a solution.

leastprivilege avatar Sep 03 '22 19:09 leastprivilege

In fact according to https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/communication/authentication?view=net-maui-6.0 the sample is not completed and with Windows will not work for a known issue

GioviQ avatar Jan 10 '23 20:01 GioviQ