Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin Forms UWP freezes when using B2C + MSA #3821

Closed
1 of 4 tasks
Surfrat opened this issue Nov 23, 2022 · 8 comments
Closed
1 of 4 tasks

Xamarin Forms UWP freezes when using B2C + MSA #3821

Surfrat opened this issue Nov 23, 2022 · 8 comments

Comments

@Surfrat
Copy link

Surfrat commented Nov 23, 2022

Which version of MSAL.NET are you using?
Version: 4.48.1

Platform
Xamarin Forms UWP

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive
    • Integrated Windows Authentication
    • Username Password
    • Device code flow (browserless)

Expected behavior
Login dialog appears.

Actual behavior
Exception thrown.

Hi,

I have followed the sample app configuration and code from here,

This app sample works for Local, MS and Google Accounts. Unfortunately most packages in this sample are very old. I have created a new sample project, that is attached, with the latest Nuget Packages. I am faced with the error:

Microsoft.Identity.Client.MsalClientException: Only loopback redirect uri is supported, but msale5737214-6372-472c-a85a-68e8fbe6cf3c://auth/ was found.

Attached is the full verbose stack trace, logs and the sample app.
Can you please help me solve this problem?

To view my B2C configuration please look here. This issue contains images of my B2C setup.

UWP Stack Trace.log
Msal.zip

Thanks

Mark and Zac.

@bgavrilMS
Copy link
Member

You are using a version of UWP which is no longer supported. Please bump it up to use at least SDK level 10.0.17763.0. All other SDKs are deprecated. Note that this doesn't mean you won't support lower runtimes, such as Win 10.0.0.0, but the SDK must be at least 10.0.17763.0

https://www.nuget.org/packages/Microsoft.Identity.Client#dependencies-body-tab

@bgavrilMS
Copy link
Member

Better yet, don't use Xamarin, it's being deprecated by Microsoft. It is being replaced by Maui. UWP is also being retired and replaced by WinUI. With Maui, you get WinUI version by default.

Here's the sample to follow: https://github.com/Azure-Samples/active-directory-xamarin-native-v2/tree/main/MAUI/MauiAppB2C

@Surfrat
Copy link
Author

Surfrat commented Nov 24, 2022

@bgavrilMS Thank you very much for your help.

Changing the min UWP version got the Local and Google accounts to work.
Screenshot - 2022-11-24 10 10 33

With my B2C tenant the Microsoft account gives me the error as I posted here. Screen shots of my B2C config are also there.

The error is:
Screenshot - 2022-11-24 10 12 34

I have also attached the verbose logs

UWP MS logs.log

The logs refer to WAB which I am not using.

I believe this is a config issue in Azure B2C as your config works. Could you please have a look at my config to help me solve this problem.

@Surfrat
Copy link
Author

Surfrat commented Nov 24, 2022

As far as using .Net Maui - I wish I could.

I am following the .Net Maui progress closely. My problem is that the third party vendors are not quite there yet with full support. My app is 80% complete and uses Prism and a lot of the Syncfusion components. I will re-asses this in a years time and make the switch then.

@bgavrilMS
Copy link
Member

bgavrilMS commented Nov 24, 2022

The SDK itself is not responsible for the content that gets displayed in the browser - that content comes from the service (the identity provider, in this case B2C). The browser is a UWP control called WAB (win auth broker - this is not the same as WAM - win auth manager). WAB is very sensitive to HTML content it has to navigate to, and will bail on any sign of a problem (e.g. a picture is linked via HTTP instead of HTTPS).

I will ping the b2c folks, but I suggest you open a ticket via Azure Portal yourself about this.

Realistically, I cannot tell you if this is going to be fixed or not. UWP is on its way out and B2C is also being redesigned to become a part of normal AAD.

@Surfrat
Copy link
Author

Surfrat commented Nov 25, 2022

Thanks very much for your insights, as it makes design decisions easier. Is it possible to only use Local login for UWP only and Local, Google and MS for Android and iOS?

This way I can side step the problem for now or use Local login only for all three platforms.

I really appreciate your help, the joys of software engineering :)

@bgavrilMS
Copy link
Member

Yeah, app models with strict constraints like UPW are hard to work with. I am not aware of any way to configure B2C to show some providers on mobile and other providers on UWP.

@bgavrilMS bgavrilMS changed the title Xamarin Forms UWP "Only loopback redirect uri is supported" Error Xamarin Forms UWP freezes when using B2C + MSA Nov 25, 2022
@bgavrilMS
Copy link
Member

bgavrilMS commented Dec 22, 2022

Won't follow up on UWP issues, please use WinUI or raise the issue via Azure Portal for B2C

@bgavrilMS bgavrilMS closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants