req.onload = function()

in username-password-auth/public/main.js [66:82]


  req.onload = function() {
    if (req.status === 400 || req.status === 401) {
      err.innerText = 'Invalid username or password';
      return;
    }
    if (req.status !== 200) {
      err.innerText = 'Invalid response from Firebase Cloud Function ' + req.status;
      return;
    }
    var data = JSON.parse(req.responseText);
    if (data.token) {
      firebase.auth().signInWithCustomToken(data.token);
    } else {
      console.log('ERROR RESPONSE: ' + req.responseText);
      err.innerText = 'Invalid response from Firebase Cloud Function see developer console for details';
    }
  };