vendredi 4 août 2017

Cannot understand Firebase Auth E-mail login

I'm about to go insane. I cannot work my head around how to create a simple email and password login with firebase auth for web.

I have added the code firebase says, with the api key, auth domain etc. to the head tag of my page.

I also have a from that looks like this:

<form>
<input id="txtEmail" type="email" placeholder="E-mail" /><br />
<input id="txtPassword" type="password" placeholder="Password" /><br /><br />
<button>Login</button> <button>Sign up</button>
</form>

Then firebase tells me to use this piece of code:

firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // ...
});

How do I use that code? How do I get the email and password from the input boxes into the email, password that are being used in the .createUserWithEmailAndPassword??

I simply cannot understand what to do......




Aucun commentaire:

Enregistrer un commentaire