2

I am using Firebase SMS verification for Authentication. The code works fine on most of the devices but it shows 'com.google.firebase.auth.FirebaseAuthException' on OPPO A37fw.

This is my code and it works fine on every devices including other Oppo devices .Only On OPPO A37fw this error is shown.

 PhoneAuthProvider.OnVerificationStateChangedCallbacks callbacks
        = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
    @Override
    public void onVerificationCompleted(PhoneAuthCredential credential) {
        Log.d(TAG, "onVerificationCompleted:" + credential);
        MobileVerification.credential = credential;
        openOTPvalidation(ON_VERIFICATION);
    }

    @Override
    public void onVerificationFailed(FirebaseException e) {
        postException(context, TAG, e);
    }

    @Override
    public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken token) {
        super.onCodeSent(s, token);
        verificationCode    = s;
        forceResendingToken = token;
        openOTPvalidation(OTP_SEND);
    }
};

private void getOTP() {
    if (activity != null) {
        pDialog = SupportingMethods.showDialogLoading(activity);
        pDialog.show();
    }
    String mobile   = "+91" + mob;
    PhoneAuthProvider.getInstance().verifyPhoneNumber(
            mobile,        // Phone number to verify
            60,                 // Timeout duration
            TimeUnit.SECONDS,   // Unit of timeout
            activity,               // Activity (for callback binding)
            callbacks);        // OnVerificationStateChangedCallbacks
}

And the Logcat shows :

   com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ] 
        at com.google.firebase.auth.api.internal.zzdr.zzb(Unknown Source) 
        at com.google.firebase.auth.api.internal.zzet.zza(Unknown Source) 
        at com.google.firebase.auth.api.internal.zzew.run(Unknown Source) 
        at android.os.Handler.handleCallback(Handler.java:739) 
        at android.os.Handler.dispatchMessage(Handler.java:95) 
        at android.os.Looper.loop(Looper.java:160) 
        at android.app.ActivityThread.main(ActivityThread.java:5541) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759) 
        ************ DEVICE INFORMATION *********** 
        Brand: OPPO 
        Device: A37f 
        Model: A37fw 
        Id: LMY47V 
        Product: A37fw
KENdi
  • 7,576
  • 2
  • 16
  • 31
H Kuttan
  • 23
  • 6
  • Seems like SH1 key is not mentioned in the firebase project. and if you did it already then try to login with test number which you can define in Authentication -> Sign-in method -> Phone -> Phone numbers for testing (optional). and if you can't sign in with the real number then maybe your number has reached maximum limit to request OTP. – Dipakk Sharma Apr 30 '19 at 05:15
  • Have a look at [this](https://stackoverflow.com/a/53513327/2289835) and [this.](https://stackoverflow.com/a/53428463/2289835) – Rumit Patel May 01 '19 at 05:48

1 Answers1

1

If you have connected firebase with the help of android assistant these kind of issues may show up.So you need to download a new copy of google-services.json file from firbase console and add it to your project folder. This might help you.

jinil joy
  • 26
  • 1