question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] AcquireTokenInteractive not return when use SystemWebView with Apple IdP (B2C)

See original GitHub issue

I try implementing Sing in with Apple in my app with AD B2C according to the following sample: https://github.com/azure-ad-b2c/samples/tree/master/policies/sign-in-with-apple

With this provider, I attempt to sign in with the AcquireTokenInteractive method on SystemWebView. It seems that the auth is complete, but the SystemWebView remains display white page, and the WebView is not closed and the control does not return to the app.

Which Version of MSAL are you using ? MSAL 4.14.0

Platform Xamarin iOS

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive
    • Integrated Windows Auth
    • Username Password
    • Device code flow (browserless)
  • Web App
    • Authorization code
    • OBO
  • Web API
    • OBO

Is this a new or existing app? This app is in production. I’m implementing Sign in with Apple, and I have upgraded to a new version of MSAL.

Repro

  1. Do Sign in with Apple on SystemWebBrowser using the following code:
authResult = await _client.AcquireTokenInteractive(Scopes)
    .WithParentActivityOrWindow(UIParent)
    .WithAccount(GetAccountByPolicy(acounts, PolicySignUpSignIn))
    .WithPrompt(Prompt.SelectAccount)
    .WithUseEmbeddedWebView(false)
    .ExecuteAsync();

Expected behavior

When complete to sign in, the callback URL will be redirected, and the system browser will be closed and then the auth result will be returned.

Actual behavior When complete to sign in, the callback URL was redirected. But the system browser was not closed, remained a white page, and the auth result was not returned.

Possible Solution

If we use the EmbeddedWebView, it works expectedly.

authResult = await _client.AcquireTokenInteractive(Scopes)
    .WithParentActivityOrWindow(UIParent)
    .WithAccount(GetAccountByPolicy(acounts, PolicySignUpSignIn))
    .WithPrompt(Prompt.SelectAccount)
    .WithUseEmbeddedWebView(true)
    .ExecuteAsync();

However, this workaround causes the google sign in problem the following: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-aad-b2c-considerations#google-auth-and-embedded-webview

Additional context/ Logs / Screenshots

IMG_2918

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bgavrilMScommented, Jun 16, 2020

Ah, never mind @jennyf19, I think I found an issue that you worked on and describes this problem: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/1491

@muak - see the investigation in issue #1491 , it seems there is a problem in iOS itself, which should have been fixed in 13.4

1reaction
justinasfour04commented, Sep 25, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Apple error "Invalid web redirect url." during Azure B2C ...
I'm trying to add Apple as an identity provider to my Azure B2C tenant, I have Microsoft and Google set up already and...
Read more >
Azure B2C Sign in with Apple generates 'invalid_grant'
We get the message: "We encountered an 'invalid_grant' error connecting to the identity provider. Please try again later." Activity Type
Read more >
Sign in with Apple を Azure AD B2C で使う時にどハマりした ...
[Bug] AcquireTokenInteractive not return when use SystemWebView with Apple IdP (B2C) · Issue #1888 · AzureAD/microsoft-authentication-library- ...
Read more >
AzureADB2C apple id authentication not working
However, based on your query, I believe you are trying to add apple IDP to Azure AD B2C but get an 'invalid client'...
Read more >
Using Azure B2C and Sign in with A…
Hello, I am currently using a React app which uses MSAL.js to authenticate with an Apple Identity Provider I have registered in Azure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found