[Bug] AcquireTokenInteractive not return when use SystemWebView with Apple IdP (B2C)
See original GitHub issueI 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
- 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
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
I was missing the manifest file edits that are needed as described here https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-xamarin-android-considerations#update-the-android-manifest