firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Receiving ERROR_INVALID_CERT_HASH even after registering the debug keystore in Firebase console

Open Manu-Jindal opened this issue 5 years ago • 3 comments

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository. If you have a general question, need help debugging, or fall into some other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 4.1.2
  • Firebase Component: Authentication (Database, Firestore, Storage, Functions, etc)
  • Component version: 17.0.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

I have added authentication via Microsoft in Firebase Auth. I have added the SHA1 and SHA256 identity of the keystore (both debug and App signing key) in the Firebase console, however, I am still receiving the error while using it -> ERROR_INVALID_CERT_HASH - There was an error while trying to get your package certificate hash.

Relevant Code:

// TODO(you): code here to reproduce the problem
                OAuthProvider.Builder provider = OAuthProvider.newBuilder("microsoft.com");
                provider.addCustomParameter("tenant", "");
                Task<AuthResult> pendingResultTask = FirebaseAuth.getInstance().getPendingAuthResult();
                if (pendingResultTask != null) {
                    // There's something already here! Finish the sign-in for your user.
                    pendingResultTask
                            .addOnSuccessListener(
                                    new OnSuccessListener<AuthResult>() {
                                        @Override
                                        public void onSuccess(AuthResult authResult) {
                                            loginUser(authResult);
                                        }
                                    })
                            .addOnFailureListener(
                                    new OnFailureListener() {
                                        @Override
                                        public void onFailure(@NonNull Exception e) {
                                            AppUtil.showToast(Login.this, e.getMessage(), Toast.LENGTH_LONG);
                                        }
                                    });
                } else {
                    FirebaseAuth.getInstance()
                            .startActivityForSignInWithProvider(/* activity= */ Login.this, provider.build())
                            .addOnSuccessListener(
                                    new OnSuccessListener<AuthResult>() {
                                        @Override
                                        public void onSuccess(AuthResult authResult) {
                                            loginUser(authResult);
                                        }
                                    })
                            .addOnFailureListener(
                                    new OnFailureListener() {
                                        @Override
                                        public void onFailure(@NonNull Exception e) {
                                            AppUtil.showToast(Login.this, e.getMessage(), Toast.LENGTH_LONG);
                                        }
                                    });
                }

Manu-Jindal avatar Mar 13 '21 11:03 Manu-Jindal

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Mar 13 '21 11:03 google-oss-bot

In order to help, we'd need access to your project settings (including the hash config), so please reach out to the personalized Firebase support channel instead.

yuchenshi avatar Mar 22 '21 21:03 yuchenshi

@yuchenshi i had the same issue, Is it possible to replicate the solution?

romellfudi avatar Mar 26 '21 15:03 romellfudi