firebase-android-sdk: Unable to authenticate with Microsoft using Firebase

I’m trying to implement authentication with Microsoft using Firebase in my app. I followed the steps mentioned in the tutorial https://firebase.google.com/docs/auth/android/microsoft-oauth.

Following are the code snippets from my application -

MSAuthManager.java

public void loginOutlook(Context context) {
    FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
    Task<AuthResult> pendingResultTask = firebaseAuth.getPendingAuthResult();

    if (pendingResultTask == null) {
        OAuthProvider.Builder provider = OAuthProvider.newBuilder("microsoft.com");
        provider.setScopes(asList(SCOPES));

        firebaseAuth.startActivityForSignInWithProvider((Activity) context, provider.build())
                    .addOnSuccessListener(this)
                    .addOnFailureListener(this)
                    .addOnCanceledListener(this);
    }
}

AndroidManifest.xml

<activity android:name="com.microsoft.identity.client.BrowserTabActivity">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https://**********.firebaseapp.com/__/auth/handler"
                  android:host="auth" />
        </intent-filter>
</activity>

Note - I have already authenticated the user with Google sign-in using Firebase on the Login Screen.

However, when I start the authentication process, a custom tab launches takes me to the Microsoft login page and then automatically closes and redirects me back to my app with the following error -

FirebaseAuthWebException: The web operation was canceled by the user.

Could anyone please tell me what am I missing here?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 19 (7 by maintainers)

Most upvoted comments

I have the same problems … I know the origin but dt know the solution…

The probleme is chrome or samsung internet browser, u have a password saved in one of this browser, and this password saved is not the good.

The web operation was canceled by the user : In my case, its means ‘wrong password’

I have a proof of this, u just have to clear all data of chrome (cache and data), and retry it works directly