我正忙于使用电子邮件魔术链接设置 firebase 身份验证并使用此处的指南:
https://firebase.google.com/docs/auth/android/email-link-auth
它说我需要将一个域列入白名单,但除了我创建的动态链接外,我在控制台中找不到任何地方可以做到这一点。我尝试运行下面的代码,但我得到了
[ UNAUTHORIZED_DOMAIN:域未被项目列入白名单]
val actionCodeSettings = ActionCodeSettings.newBuilder()
// URL you want to redirect back to. The domain (www.example.com) for this
// URL must be whitelisted in the Firebase Console.
.setUrl("https://myapphere.page.link/register") //I created this dynamic link in the firebase console
.setHandleCodeInApp(true)
.setAndroidPackageName(
"com.myapphere",
true,
"1")
.build()
val auth = FirebaseAuth.getInstance()
auth.sendSignInLinkToEmail(email, actionCodeSettings)
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// Sign in success, update UI with the signed-in user's information
} else {
// If sign in fails, display a message to the user.
}
}
我不应该使用动态链接进行 firebase 身份验证吗?如果是这样,我在控制台的哪个位置将域列入白名单,因为我找不到它。
原文由 Jacques.S 发布,翻译遵循 CC BY-SA 4.0 许可协议