title: email/password authentication for firebase SERVER_ERROR
body: <p>I'm trying to use Firebase's simple login and attempting to follow the general methods laid out in <a href="https://stackoverflow.com/questions/15167981/how-do-i-use-firebase-simple-login-with-email-password">How do I use Firebase Simple Login with email &amp; password</a>. </p>
  
  <p>Everytime I try to create a new user (or sign in), however, I get a</p>
  
  <blockquote>
    <p>SERVER_ERROR: The connection to wss://s-xxxxxxxx was interrupted while the page was loading. </p>
  </blockquote>
  
  <p>How is this caused and how can I solve it?</p>
  
  <p>Also, it works on Firefox when I hardcode values (i.e. take createUser outside of the register submit handler), but not on Chrome.</p>
  
  <p><code>login.html</code></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"&gt;
      &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type='text/javascript' src='https://cdn.firebase.com/v0/firebase.js'&gt;&lt;/script&gt;
      &lt;script type='text/javascript' src='https://cdn.firebase.com/v0/firebase-simple-login.js'&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="login_or_register"&gt;
          &lt;/div&gt;
          &lt;button id="logout"&gt;Logout&lt;/button&gt;
          &lt;script type='text/javascript' src='loginScript.js'&gt;&lt;/script&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>loginScript.js</code></p>
  
  <pre><code>function showLoginRegister(auth){
  
                      $register_form = $('&lt;form id="register"&gt;'+
                        '&lt;input type="text" name="register-email" id="register-email" value="email@example.com"&gt;'+
                      '&lt;input type="password" name="register-password" id="register-password" value="password"&gt;'+
                      '&lt;input type="submit" value="Create an account!"/&gt;'+'&lt;/form&gt;')
  
                      $login_form = $('&lt;form id="login"&gt;'+'&lt;input type="text" name="login-email" id="login-email" value="email@example.com"&gt;'+
                      '&lt;input type="password" name="login-password" id="login-password" value="password"&gt;'+
                      '&lt;input type="checkbox" name="rememberCheckbox" id="rememberCheckbox" checked&gt;'+
                      '&lt;input type="submit" value="Sign in"/&gt;'+'&lt;/form&gt;')
                      $('#login_or_register').append($register_form,$login_form);
  
                      $("#register").submit(function() {
                          var email = $("#register-email").val();
                      var password = $("#register-password").val();
                      auth.createUser(email, password, function(error, user) {
                              if (!error) {
                                    auth.login("password", {
                                    email: email,
                                      password: password,
                                      rememberMe: false
                                  });
                              }
                              else{
                                  console.log(error);
                              }
                          });
                      });
  
                      $("#login").submit(function() {
                          var email = $("#login-email").val();
                      var password = $("#login-password").val();
                      var checkbox = $("#rememberCheckbox").val();
                        auth.login("password", {
                              email: email,
                              password: password,
                              rememberMe: checkbox
                          });
                      });  
                  };
  
  
                  var ref = new Firebase('https://xxx.firebaseio.com/');
                  var auth = new FirebaseSimpleLogin(ref, function(error, user) {
                      if (error){
                          console.log(error);
                        return;
                    }
                    if (user) {
                      // user authenticated with Firebase
                          $("#logout").click(function(){
                              auth.logout();
                         })
                    } 
                    else {
                      showLoginRegister(this);
                        // user is logged out
                    }
                  });
  </code></pre>