Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase says "Domain not whitelisted" for a link that is whitelisted

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.

like image 869
Jacques.S Avatar asked Jul 17 '18 06:07

Jacques.S


People also ask

How do I change my Auth domain in firebase?

Add the custom domain to the list of Authorized Domains. Update the Callback URL with your identity provider to use your custom domain instead of the default domain. For example, change https://myproject.firebaseapp.com/__/auth/handler to https://auth.mycustomdomain.com/__/auth/handler . Click Save.


2 Answers

  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"

Scroll further down on this page

like image 101
Jacques.S Avatar answered Sep 19 '22 16:09

Jacques.S


I had the same problem, the reason was my SHA-1 key configured in Firebase was wrong.

like image 39
Jack' Avatar answered Sep 19 '22 16:09

Jack'