Logs and Network traces
No logs available.
Which Version of MSAL are you using ?
Microsoft.Identity.Client v4.23 (iOS)
Platform
xamarin iOS
What authentication flow has the issue?
Is this a new or existing app?
The app is in production, I haven't upgraded MSAL, but started seeing this issue
Repro
result = await authClient
.AcquireTokenInteractive(ADB2CConstants.Scopes)
.WithPrompt(Prompt.SelectAccount)
.WithParentActivityOrWindow(_ParentWindow)
.ExecuteAsync();
Expected behavior
The window doesn't hide
Actual behavior
The login window hides and the application can do nothing
Possible Solution
Additional context/ Logs / Screenshots
I have recorded this behaviour. You can see it at https://youtu.be/EOpaFUjsbaw
@dsancho thanks for opening the issue. Do you have OpenUrl set up correctly in AppDelegate.cs to handle the callback?
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(url);
return true;
}
Also, are you setting the ParentWindow to anything for iOS?
Is this a previously working scenario?
Can you point us to a repro or code?
Yes, I have override the OpenUrl function:
public override bool OpenUrl(UIApplication a_App, NSUrl a_Url, NSDictionary a_Options)
{
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(a_Url);
return base.OpenUrl(a_App, a_Url, a_Options);
}
Also, are you setting the ParentWindow to anything for iOS?
Yes, as parent window I'm using new UIViewController().
Is this a previously working scenario?
I don't know. I haven't test this scenario before.
This is the code I use to create authClient:
var authClient = PublicClientApplicationBuilder.Create(ADB2CConstants.ClientId)
.WithIosKeychainSecurityGroup(ADB2CConstants.IosKeychainSecurityGroups)
.WithB2CAuthority(ADB2CConstants.AuthoritySignin)
.Build();
and later I execute:
result = await authClient
.AcquireTokenInteractive(ADB2CConstants.Scopes)
.WithPrompt(Prompt.SelectAccount)
.WithParentActivityOrWindow(_ParentWindow)
.ExecuteAsync();
@dsancho
What do you have in the info.plist for CFBundleURLSchemes?
Also, what about the redirect URI? .WithRedirectUri($"msal{ClientID}://auth")
There is no problem trying to login.
Login works as expected if I push any of the buttons (apple, google, facebook).
The problem it's if the user touches the screen outside the login window (I suppose it's the webview). Then the login window hides and the application keeps waiting for the login but no way to show again the login window.
I'm sorry if I didn't make myself clear.
Yes, i understood. Just making sure everything is set-up correctly, but good to know regular sign-in works.
@trwalke have you tried this before?
I'm using the simulator and an iPad with iOS 14.2
@jennyf19 yeah, but usually there is a cancellation exception. Ill try again
@jennyf19 I tried this on a device with ios 14 and this is indeed an issue. Once I tap on the outside of the browser it goes away and nothing happens. Then, each interactive sign in attempt after that is blocked with a Authentication Cancellation exception.
perhaps this should be p1?
Not blocking, let's keep it as P2.
@dsancho Similar issue was reported in the iOS native sdk. They have reported a bug to Apple.
@dsancho closing, as external to MSAL, but we will update here when we hear from our iOS team on progress from Apple. you can also follow the issue that @neha-bhargava linked above. thanks for letting us know on this one.
Most helpful comment
@dsancho Similar issue was reported in the iOS native sdk. They have reported a bug to Apple.