How to open microsoft authenticator from ios app?

SHEHZAD SULAIMAN 0 Reputation points


I am encountering with the Microsoft Authenticator app integration in my iOS application.

When attempting to open the Microsoft Authenticator app from my iOS application using a custom URL scheme, I am unable to prompt the user to enter an OTP (One-Time Password) immediately. The app opens successfully, but the OTP prompt does not appear until the app is manually refreshed.

    public static func openMicrosoftAuthenticatorForAuthentication() {
        let clientID = Constants.microsoftClientID
        let urlString = "msauthv2://\(clientID)"
        guard let url = URL(string: urlString) else {
            print("Failed to create URL for Microsoft Authenticator.")
        if UIApplication.shared.canOpenURL(url) {
  , options: [:], completionHandler: { success in
                if success {
                    print("Microsoft Authenticator was opened successfully.")
                } else {
                    print("Failed to open Microsoft Authenticator.")
        } else {
            print("Microsoft Authenticator is not installed or the URL scheme is incorrect.")

I would greatly appreciate your assistance in resolving this issue. If there are any specific parameters or configurations required to achieve the desired behavior of prompting OTP immediately upon opening the Microsoft Authenticator app, please provide guidance on how to implement them correctly.

Additional Information:

  • iOS Version: 14+
  • Microsoft Authenticator Version: Latest
  • Development Language: Swift
Microsoft Authenticator
Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
5,832 questions
0 comments No comments
{count} votes