在Android中使用电子邮件链接通过Firebase进行身份验证:UNAUTHORIZED_DOMAIN错误

时间:2018-06-25 09:19:08

标签: android firebase firebase-authentication

quickstart-android个示例项目中,我正在尝试针对以下版本的无密码方法的Firebase Auth Quickstart示例:

parser.add_argument('-a', '--add', help ="Add device", metavar='', required=True)

我已经按照项目README中的说明进行了设置,但是出现以下错误(Logcat):

// Firebase Authentication
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-core:16.0.0'

// Google Sign In SDK (only required for Google Sign In)
implementation 'com.google.android.gms:play-services-auth:15.0.1'

// Firebase UI
// Used in FirebaseUIActivity.
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'

06-25 10:51:31.603 3657-3657/com.google.firebase.quickstart.auth W/PasswordlessSignIn: Could not send link com.google.firebase.FirebaseException: An internal error has occurred. [ UNAUTHORIZED_DOMAIN:Domain not whitelisted by project ] at com.google.firebase.auth.api.internal.zzce.zzb(Unknown Source:55) 表包含Firebase->Authentication->Authorized domain作为授权域。

我想念什么?

3 个答案:

答案 0 :(得分:0)

enter image description here

首先请确保已将域'yourdomain.com'添加到Firebase的“授权”域中的“身份验证”菜单中。如果您已经在其中声明了域,则假设您正在使用:

compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    minSdkVersion 16
    targetSdkVersion 27
}

尝试更新为最新版本,例如:

    // Firebase Authentication
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'

// Google Sign In SDK (only required for Google Sign In)
    implementation 'com.google.android.gms:play-services-auth:15.0.1'

// Firebase UI
// Used in FirebaseUIActivity.
    implementation 'com.firebaseui:firebase-ui-auth:4.0.1'

还要确保您正在使用:

implementation "com.android.support:design:27.1.1"
implementation "com.android.support:customtabs:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"

如果您使用的是其他Firebase库,请检查所有内容是否基于on this link

    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-analytics:16.0.1'
    implementation 'com.google.firebase:firebase-appindexing:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.2'
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-functions:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.1'
    implementation 'com.google.firebase:firebase-invites:16.0.0'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'

答案 1 :(得分:0)

对我来说,它可以使用以下方法工作:

ActionCodeSettings settings = ActionCodeSettings
  .newBuilder()
  .setUrl("https://auth.example.com/emailSignInLink")

也在控制台中设置授权域:auth.example.com

答案 2 :(得分:0)

来自 Vel_daN 的逐步修复指南 ?


1️⃣ 从动态链接复制域:

enter image description here


2️⃣ 转到登录方法中的身份验证:

enter image description here


3️⃣ 添加您的域:

enter image description here


附注。 Vel_dan:爱你所做的?。