Workflow on iOS not working correctly
See original GitHub issueWe have implemented our login to use Azure AD B2C as per this example. It works perfectly fine with Android but we’re having some weird issues with iOS (I raised a different but related issue just before Xmas).
Here is the flow on the iOS version of the app.
- User launches the app and is presented with the Azure AD B2C login screen (correct)
- User enters their credentials (correct)
- The app redirects the user back to the login screen (with the username and password fields blank) (wrong)
- After a few seconds the app then logs them in and navigates them to the main screen
After entering their credentials the user should be immediately navigated to the app main screen, NOT back to the login screen. Once they are logged in, subsequently launching the app correctly logs them in. The problem is only on first login.
After some investigation it seems that this method may be causing the issue.
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
AuthenticationContinuationHelper.SetAuthenticationContinuationEventArgs(url);
return true;
}
According to the docs
this logic is meant to ensure that once the interactive portion of the authentication flow is concluded, the flow goes back to MSAL
But it doesn’t. It redirects the user back to the OnAppearing() method of the login page where it attempts (again) to acquire a token (which it does).
Is there any way to fix the behaviour of this method?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
After the sugesiton by @jennyf19 I have refactored our code as follows.
OnStart
() in App.xaml.csI have tested this on iOS and Android and all seems to work perfectly.
Many thanks to @jennyf19 for the suggestion and helping me fix this issue 👍
@jennyf19 So it is, I didn’t spot that. I’ll have a look at refactoring the code so as to move the silent call out of the
OnAppearing
method. Thanks for the update on this.