Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    Non-Abelian anyons: anything but easy

    January 25, 2026

    Announcing Amazon EC2 G7e instances accelerated by NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs

    January 25, 2026

    Tech CEOs boast and bicker about AI at Davos

    January 25, 2026
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»xamarin.ios – MSAL .NET MAUI iOS + Azure B2C: sign-in stuck / authentication_canceled on TestFlight but works in debug
    iOS Development

    xamarin.ios – MSAL .NET MAUI iOS + Azure B2C: sign-in stuck / authentication_canceled on TestFlight but works in debug

    big tee tech hubBy big tee tech hubDecember 11, 2025002 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    xamarin.ios – MSAL .NET MAUI iOS + Azure B2C: sign-in stuck / authentication_canceled on TestFlight but works in debug
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    I am building a .NET MAUI mobile app that uses MSAL.NET to authenticate with Azure AD B2C.

    On iOS TestFlight builds, when I call AcquireTokenInteractive(), the system browser (ASWebAuthenticationSession) never opens.
    My loading UI appears, but the B2C login page never shows.
    Eventually, MSAL throws:

    MsalClientException: authentication_canceled
    

    On iOS Debug builds, everything works perfectly:

    • Browser opens
    • B2C login page loads
    • Redirect returns
    • Authentication succeeds

    So the issue happens only in TestFlight, not in Debug mode.


    CFBundleURLTypes
    
      
        CFBundleTypeRole
        Editor
        CFBundleURLName
        msal-
        CFBundleURLSchemes
        
          msal
        
      
    
    
    LSApplicationQueriesSchemes
    
      msauth
      msauthv2
      msauthv3
      msauthv3.0
    
    

    public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
    {
        AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(url);
        return true;
    }
    
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        if (!NSUserDefaults.StandardUserDefaults.BoolForKey("firstLaunchDone"))
        {
            var pcaWrapper = (IPcaWrapper)Current.Services.GetService(typeof(IPcaWrapper));
            var pca = ((PcaWrapper)pcaWrapper).PublicClientApplication;
    
            var accounts = pca.GetAccountsAsync().Result;
            foreach (var acc in accounts)
                pca.RemoveAsync(acc).Wait();
    
            NSUserDefaults.StandardUserDefaults.SetBool(true, "firstLaunchDone");
        }
    
        return base.FinishedLaunching(app, options);
    }
    

    public PcaWrapper(IConfiguration configuration)
    {
        settings = configuration.GetRequiredSection("Settings").Get();
    
        Scopes = BuildScopes(settings);
    
        string redirectUri = string.IsNullOrWhiteSpace(PlatformConfig.Instance.RedirectUri)
            ? settings.RedirectUri   // 
            : PlatformConfig.Instance.RedirectUri;
    
        PlatformConfig.Instance.RedirectUri = redirectUri;
    
        authority = BuildAuthority(settings); // https:///
    
        PublicClientApplication = PublicClientApplicationBuilder
            .Create(settings.ClientId) // 
            .WithB2CAuthority(authority)
            .WithRedirectUri(redirectUri)
            .WithIosKeychainSecurityGroup("com.microsoft.adalcache")
            .Build();
    }
    

    private async Task AcquireTokenInteractiveInternalAsync(string[] scopes)
    {
        var builder = PublicClientApplication
            .AcquireTokenInteractive(scopes)
            .WithB2CAuthority(authority)
            .WithUseEmbeddedWebView(true);
    
        if (PlatformConfig.Instance.ParentWindow != null)
        {
            builder = builder.WithParentActivityOrWindow(PlatformConfig.Instance.ParentWindow);
        }
    
        return await MainThread.InvokeOnMainThreadAsync(() => builder.ExecuteAsync());
    }
    

    "Settings": {
      "ClientId": "",
      "TenantId": "",
      "Instance": "https://.b2clogin.com",
      "Domain": ".onmicrosoft.com",
      "SignUpSignInPolicyId": "",
      "RedirectUri": "msal://auth",
      "Scopes": [
        { "Value": "openid" },
        { "Value": "offline_access" }
      ]
    }
    

    • App launches
    • I call AcquireTokenInteractive()
    • My loading UI appears
    • System browser never opens
    • No login page
    • No redirect
    • Eventually MSAL throws authentication_canceled

    This does not happen in Debug mode.


    • Redirect URI registered in Azure B2C
    • Matching scheme added to Info.plist
    • Keychain access group set (com.microsoft.adalcache)
    • AppDelegate.OpenUrl implemented
    • No SceneDelegate (MAUI default)
    • Tried embedded + system browser
    • TestFlight entitlements appear correct

    Still the browser does not launch.


    Why does ASWebAuthenticationSession fail to open only in TestFlight builds, and could this be caused by missing plist capabilities, redirect URI format issues, required entitlements, or any TestFlight-specific restrictions affecting MSAL.NET MAUI interactive login?
    Any help would be greatly appreciated.



    Source link

    .NET authentication_canceled Azure B2C Debug iOS Maui MSAL SignIn stuck TestFlight works xamarin.ios
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    ios – Why does my page scroll up when I tap on a button?

    January 25, 2026

    swift – iOS suspends app after BLE discovery even though I start Always-authorized location udpates

    January 24, 2026

    ios – ASAuthorizationControllerDelegate always returns .canceled for Face ID passcode fallback and failed attempts

    January 23, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Non-Abelian anyons: anything but easy

    January 25, 2026

    Announcing Amazon EC2 G7e instances accelerated by NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs

    January 25, 2026

    Tech CEOs boast and bicker about AI at Davos

    January 25, 2026

    How Content Management Is Transforming Construction ERP

    January 25, 2026
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    Non-Abelian anyons: anything but easy

    January 25, 2026

    Announcing Amazon EC2 G7e instances accelerated by NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs

    January 25, 2026

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2026 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.