0

I want to authenticate the user, but it does not work and face this error:

OPTIONS
https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyA0l_mJgQpfidi7_aWAKGgGfjv18ESUirQ
CORS Missing Allow Origin
=================================
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=AIzaSyA0l_mJgQpfidi7_aWAKGgGfjv18ESUirQ. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 403.
==================================

My database is firebase 9, and I have used React as UI and logic.

It was working, but now I cannot get response from my database.

const handleSubmit = async (e) => {
  e.preventDefault();
  try {
  
    const auth = getAuth();

    const userCredential = await createUserWithEmailAndPassword(
      auth,
      email,`your text`
      password
    );

    const user = userCredential.user;
    updateProfile(auth.currentUser, {
      displayName: name,
    });

  
    const formDataCopy = { ...formData };

    delete formDataCopy.password;

    formDataCopy.timestamp = serverTimestamp();

    await setDoc(doc(db, "users", user.uid), formDataCopy);
    navigate("/");
  } catch (error) {
    toast.error("Something went wrong with registration");
  }
};
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Does this answer your question? [No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API](https://stackoverflow.com/questions/43871637/no-access-control-allow-origin-header-is-present-on-the-requested-resource-whe) – jub0bs Jun 19 '23 at 11:24

0 Answers0