Fabric-Digits and FirebaseAuth conflict on Android

264 views Asked by At

I'm having troubles integrating both Fabric-Digits and Firebase into my android app.

  • Using Digits to verify user's phone number.

  • Using Firebase as a basic back-end service (Auth, Database, app invites and FCM).

Here's how I'm authenticating with Digits then with Firebase

authConfigBuilder = new AuthConfig.Builder()
        .withAuthCallBack(new AuthCallback() {
            @Override
            public void success(DigitsSession session, String phoneNumber) {
                phoneVerified(phoneNumber);
            }
            @Override
            public void failure(DigitsException error) {
                error.printStackTrace();
            }
        });

// on a button click
AuthConfig authConfig = authConfigBuilder.withPhoneNumber(phone).build();
    Digits.authenticate(authConfig);

private void phoneVerified(String phoneNumber) {
    // authenticate with firebase using a dummy email/password
    String email = phoneNumber + "@domain.io"
    String password = "MyDomain@123"
    mAuth.createUserWithEmailAndPassword(email, password)
                .addOnCompleteListener(activity, task -> {
                    // this is never called.
                }).addOnFailureListener(e -> {
                    // this is also never called.
                    e.printStackTrace();
                });   
}

The problem here is that neither the OnCompleteListener nor the OnFailedListener is being called, although the user is successfully authenticated and I can see the email in the Firebase Console!

Something worth mentioning, when I remove the Digits Authentication line and verify phone input immediately, the problem goes away and everything works as expected.

Also, tried clearing Digits session after the phoneNumber is verified, but no luck!

0

There are 0 answers