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");
}
};