问题
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:
I figured it out. If you are on the Firebase Console on the Authentication page, you can scroll down and you need to add your dynamic link as a whitelisted domain down there.
I was on that page dozens of times and never saw an indication I could scroll down. Hopefully this helps someone.
来源:https://stackoverflow.com/questions/51374411/firebase-says-domain-not-whitelisted-for-a-link-that-is-whitelisted