Firebase 显示“域未列入白名单"对于列入白名单的链接 [英] Firebase says "Domain not whitelisted" for a link that is whitelisted

查看:40
本文介绍了Firebase 显示“域未列入白名单"对于列入白名单的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正忙于使用电子邮件魔术链接和此处的指南设置 Firebase 身份验证:

I am busy setting up a firebase authentication using an email magic link and using the guide here:

https://firebase.google.com/docs/auth/android/email-link-auth

It says I need to whitelist a domain, but I cannot find any place in the console to do that, other than the dynamic link I created. I tried running the below code, but I get

[ UNAUTHORIZED_DOMAIN:Domain not whitelisted by project ]

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

Am I not supposed to use dynamic links for firebase authentication? And if so, where in the console do I whitelist domains, because I cannot find it.

解决方案

  1. Go to Firebase Console
  2. Click Authentication Menu > Sign-in method tab
  3. Scroll Down to Authorized domains
  4. Click "Add domain" button, add your domain (website domain with parameter) and click "Add"

这篇关于Firebase 显示“域未列入白名单"对于列入白名单的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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