Firebase Auth/unauthorized domain. But the domain is already set

762 Views Asked by At

The authDomain given inside the firebaseConfig when creating the web application is set as a default domain inside the authorized domains.
But still, when I try to use the login with popup it gives the "unauthorized domain" error. I don't know what to do at this point.
I'm using this library: https://github.com/wobsoriano/solid-firebase but I don't think that's the problem.

Here is the code:

const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const provider = new GoogleAuthProvider();
const db = getFirestore(app)


const Login = () => {
  const signIn = () => signInWithPopup(auth, provider)

  return <button onClick={signIn}>Sign In with Google</button>
}

const App = () => {
  const state = useAuth(auth)
  return (
    <Switch>
      <Match when={state.loading}>
        <p>Loading...</p>
      </Match>
      <Match when={!state.data || state.error}>
        <Login />
      </Match>
      <Match when={state.data}>
        <p>Logged</p>
      </Match>
    </Switch >
  )
}
1

There are 1 best solutions below

0
Vo Manh Kien On

enter image description here

Just go to Authentication Settings and add your domain to that.