My firebase isn't creating users and it isn't giving any errors. I have been trying to fix this for about 25 hours i think... My code is
<!DOCTYPE html>
<!--suppress HtmlRequiredLangAttribute -->
<html>
<head>
<link rel="stylesheet" href="src/style/login.css">
<script src="src/js/login.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Project Cross Comm!</title>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.16.0/firebase-app.js";
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/9.16.0/firebase-auth.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "private",
authDomain: "private",
databaseURL: "private",
projectId: "private",
storageBucket: "private",
messagingSenderId: "private",
appId: "private,
measurementId: "private",
};
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
//on click of button with id register, run function register
document.getElementById("register1").addEventListener("click", register);
function register() {
const email = document.getElementById("emailinput").value;
const password = document.getElementById("passinput").value;
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
// ..
});
}
function login() {
const email = document.getElementById("emailreauth").value;
const password = document.getElementById("log-pass").value;
signInWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
// ...
})
.catch((error) => {
const errorCode = error.code;
const errorMessage = error.message;
});
}
</script>
</head>
<body>
<div class="form">
<form class="register-form" id="register">
<img src="src/IMG/profile.png" alt="profile">
<h1>Register</h1>
<input type="text" id="usernameinput" name="createUsername" placeholder="Username">
<input type="email" id="emailinput" value="" placeholder="example@example.com" name="createEmail">
<input type="password" id="passinput" value="" placeholder="password" name="createPass">
<button id="register1">create</button>
<p class="message">Already registered? <a onclick="gotologin()">Sign In</a></p>
</form>
<form class="login-form" id="login">
<img src="src/IMG/profile.png" alt="profile">
<h1>Login</h1>
<input type="email" placeholder="username" id="emailreauth" />
<input type="password" placeholder="passreauth" id="log-pass" value="" />
<button id="signin" onclick="login()">login</button>
<p class="message">Not registered? <a onclick="gotoregister()">Create an account</a></p>
</form>
</div>
<button id=mystat onclick="status01()">CLICK me to GET Status</button>
<button id=mystat onclick="logout()">CLICK me to logout </button>
</body>
<footer>
<noscript>Man, sucks for you! We only support modern, functioning browsers. Maybe you should get JavaScript
</noscript>
</footer>
</html>
I have tried searching the internet. Using every type of import. using a seperate file, older versions. Recreating youtube tutorials. Copying official code. I'm out of idea's