I used google firebase phone authentication this is my code: https://codeshare.io/5MrgVy until yesterday it worked, today instead every time I enter a phone number the toast appears which should appear in this case:
public void onVerificationFailed (FirebaseException e) {loadingBar.dismiss ();
Toast.makeText (RegistrationActivity.this, "Invalid number entered ...", Toast.LENGTH_SHORT) .show ();
relativeLayout.setVisibility (View.VISIBLE);
continueAndNextBtn.setText ("Continue"); // Continue
codeText.setVisibility (View.GONE);
}
Lately I did a referactor to change the name of the project package, and after doing this it gave me this error: No matching client found for package name 'com.conta.ftof' I solved that error by replacing the old packages inside google-services.json with the new one. I told you this because I'm afraid this is the cause. How could I fix the authentication fact?
edit:
I noticed this strange thing in the build output:
activity#com.google.firebase.auth.internal.FederatedSignInActivity@android: launchMode was tagged at AndroidManifest.xml: 24 to replace other declarations but no other declaration present
logcat
2020-10-11 21:25:28.819 15302-15302/com.conta.ftof E/RegistrationActivity: err : com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
AndroidMAnifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.conta.ftof">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".donate" />
<activity android:name=".VideoCallActivity" />
<activity android:name=".CallingActivity" />
<activity android:name=".ProfileActivity" />
<activity android:name=".FindPeopleActivity" />
<activity android:name=".NotificationsActivity" />
<activity android:name=".SettingsActivity" />
<activity
android:name=".ContactsActivity"
android:label="@string/title_activity_main" />
<activity android:name=".RegistrationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3400243939195187~6852949310"/>
<receiver android:name=".ReminderBroadcast"/>
</application>
</manifest>
there can be many reasons of the failure. you can try the folowing
try checking every case
[EDIT]: FIREBASE PHONE AUTH ERROR HANDLING
try the following code it ll help you a bit
@Override
public void onVerificationFailed(FirebaseException e) {
if (e instanceof FirebaseAuthInvalidCredentialsException) {
// Failed to verify due to wrong format mobile number
} else if (e instanceof FirebaseTooManyRequestsException) {
// Failed to verify due to usage over quota limit
}
}
@Harkal
Logcat after the click on the btn continue
2020-10-11 21:25:28.819 15302-15302/com.conta.ftof E/RegistrationActivity: err : com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
I solved. The cause was that I had changed the package name and therefore would have to change the package name in firebase as well. I created a new app on firebase and this time I put the right package name, replacing the google-services.json file with the old one ... Now it works!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.