电话身份验证Google Firebase失败 [英] Phone authentication google firebase failed

查看:101
本文介绍了电话身份验证Google Firebase失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了Google Firebase电话身份验证,这是我的代码: https://codeshare.io/5MrgVy 直到昨天为止有效,今天改为每次我输入电话号码时,都会出现吐司,在这种情况下应该出现:

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);


            }

最近,我做了一个引荐人来更改项目包的名称,执行此操作后,它给了我这个错误:找不到与包名称'com.conta.ftof'相匹配的客户端.我通过将google-services.json中的旧软件包替换为新软件包解决了该错误.我告诉你这是因为我担心这是原因.我该如何解决身份验证问题?

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?

我在生成输出中注意到了这个奇怪的事情:

I noticed this strange thing in the build output:

activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:在AndroidManifest.xml:24处标记了launchMode来替换其他声明,但没有其他声明

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:

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

尝试检查每种情况

:FIREBASE电话授权错误处理

: 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
    }
}

这篇关于电话身份验证Google Firebase失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆