-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling exception: SDK canceled the auth flow #1819
Comments
Hi @slakshmanan-isn , Thanks for posting it here. We are taking a look into your issue and will get back with response. |
@slakshmanan-isn • You can try one of these option based on your convenience. Please note that we have not yet validated or tested each option ourselves. The list is intended to offer you a range of possibilities to consider, and we encourage you to try them out based on your specific needs and preferences. • Use Custom Tabs or Browser: Instead of relaunching the app, consider using custom tabs or launching a browser to display the OTP code. This way, the app remains in the background, and the authentication flow can continue seamlessly when the user returns to it. OR • Maintain an auth state variable to detect an ongoing authentication flow in your app. When the app is relaunched, check if there is an existing authentication flow in progress using the state variable status. If so, the dev can either prompt the user to return to the previous instance of the app or display a message informing them that an authentication flow is already in progress. OR • Store the state of the authentication flow (e.g., phone number, OTP code) in a persistent storage (e.g., SharedPreferences, a local database). When the app is relaunched, retrieve the stored data and resume the authentication flow from where it was left off. Make sure to handle any expired OTP codes or potential security risks associated with storing sensitive information. Hope that you find a solution that meets your requirements. If you have any further questions, please don't hesitate to ask. |
Describe the bug
Note: This is not a bug in the MSAL SDK. We want to get some guidance/best practices on handling a scenario.
We use the MSAL library for password-less login using a phone number and OTP code sent to the phone. I'm running into a scenario we see an error.
com.microsoft.identity.client.exception.MsalClientException: Sdk canceled the auth flow as the app launched a new interactive auth request.
Smartphone:
Stacktrace
Attached logs:
azure-login-flow.log
To Reproduce
(Generic steps as I can't disclose app details)
com.microsoft.identity.client.exception.MsalClientException: Sdk canceled the auth flow as the app launched a new interactive auth request.
Our initial idea was to catch this exception and restart the auth flow manually, but then this will become a loop where the user repeats the same step.
Is there a way to resume the authentication flow from where it was left in this scenario? or Is there any recommended way of handling the exception thrown?
Additional context
Appreciate the support!
The text was updated successfully, but these errors were encountered: