Blazor Hybrid Azure B2C Login Setup (MSAL) for iOS

0
1
Blazor Hybrid Azure B2C Login Setup (MSAL) for iOS


I arrange the identical for Android and that works high-quality. I did not discover a particular instance for iOS, from totally different articles and with copilot my setup seems like this:

I added to the information.plist the next part

 CFBundleURLSchemes
 
   msal{app-client-id}
 

That is how I arrange the PCA:

                PCA = PublicClientApplicationBuilder
                                       .Create(_settings?.ClientId)
#if IOS
                                       .WithRedirectUri($"msal{client-id}://auth")
                                       .WithIosKeychainSecurityGroup("com.microsoft.adalcache")
#endif
                                       .WithB2CAuthority(_settings?.Authority)
                                       .Construct();

And that is how I name it:

        public async Activity AcquireTokenInteractiveAsync(string[] scopes)
        

I additionally arrange the PlatformConfig.Occasion.ParentWindow this manner:

            var builder = MauiApp.CreateBuilder();
            builder
                .UseMauiApp()
                .ConfigureFonts(fonts =>
                {
                    fonts.AddFont("OpenSans-Common.ttf", "OpenSansRegular");
                }).ConfigureLifecycleEvents(occasions =>
                {
#if IOS
                    occasions.AddiOS(iOS =>
                    {
                        iOS.FinishedLaunching((app, args) =>
                        {
                            PlatformConfig.Occasion.ParentWindow = UIKit.UIApplication.SharedApplication.KeyWindow;
                            return true;
                        });
                    });
#endif
                }); ;

All of it works high-quality it opens the embeded browser I enter the credentials it closes it but it surely would not hit the second breakpoint:

enter image description here

LEAVE A REPLY

Please enter your comment!
Please enter your name here