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.

Workflow on iOS not working correctly

See original GitHub issue

We 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.

  1. User launches the app and is presented with the Azure AD B2C login screen (correct)
  2. User enters their credentials (correct)
  3. The app redirects the user back to the login screen (with the username and password fields blank) (wrong)
  4. 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:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
DominicBurfordcommented, Feb 13, 2019

After the sugesiton by @jennyf19 I have refactored our code as follows.

  • The app attempts to acquire a token silently in the app OnStart() in App.xaml.cs
  • If successful the user is navigated to the Login page (but only to immediately pass-through to the MainPage)
  • If unsuccessful the user is navigated to the Login page where they need to enter their credentials. If successful they are navigated to the MainPage.

I 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 👍

1reaction
DominicBurfordcommented, Feb 12, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workflow not running properly on ios 14
I have a workflow automation as reading the weather after alarm goes off. It worked well on iOS 13, but on iOS 14...
Read more >
Slack Workflow on Mobile App not working properly
Check if the command is set up correctly : Ensure that the command is set up correctly and has the correct syntax. You...
Read more >
Detection of managed workflow for iOS platform doesn't ...
To add a bit more to this problem, patching eas-cli to properly detect a managed workflow is only part of the solution. During...
Read more >
iOS Troubleshooting
If you're having trouble using WorkflowMax for iOS, use this troubleshooting page to quickly find answers to your questions.
Read more >
Xcode Cloud Workflow Fails to Run Tests: A Guide for Data ...
In this article, we will explore the reasons why Xcode Cloud workflows fail to run tests and provide solutions to fix these issues....
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