I'm starting with firebase. I have a registration screen in html and the js that contains the script of the firebase authentication, as it comes in its documentation.
However, when filling in the registration form, users are not created in firebase
html
<head>
<script src="https://www.gstatic.com/firebasejs/5.7.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "xxx-Xto4",
authDomain: "xxx.firebaseapp.com",
databaseURL: "https://xxx.firebaseio.com",
projectId: "xxx",
storageBucket: "xxx.appspot.com",
messagingSenderId: "xxx"
};
firebase.initializeApp(config);
</script>
</head>
<div class="container h-100">
<div class="row h-100 justify-content-center align-items-center">
<div class="card col-4" style="width: 18rem;">
<div class="card-body">
<form>
<div id="signup-form" class="form-group">
<label for="inputEmail">Email address</label>
<input id="email" type="email" class="form-control" aria-describedby="emailHelp" placeholder="Enter email">
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input id="password" type="password" class="form-control" placeholder="Enter Password">
</div>
<button onclick="register()" type="submit" class="btn btn-primary">Sign up</button>
</form>
</div>
</div>
</div>
</div>
js
function register() {
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode);
console.log(errorMessage);
// ...
});
}
I do not know if there is any more configuration to be done in firebase
thank you very much!