samedi 3 juillet 2021

Updating user info Firebase Web

I have a web application created with HTMLL, CSS, JS and Firebase. I am using Firebase Authentication Email&Password verification. I can create a user acconut, but my function for adding aditional information not work. I need to save property "displayname" and "photoURL".

Here is my code in JS:

//Get current user data
    var user = firebase.auth().currentUser;

    user.updateProfile({
      displayName: "John",
      photoURL: "/images/profile.jpg"
    }).then(function() {
      window.location = "/dashboard.html"
      console.log("Succssesly created data")
    }).catch(function(error) {
      alert("Something went wrong")
      console.log(error)
      console.log("Data create error")
    });
  })

Wierd is that never exception was catched. Every time console write succsses and I am redirected to dashboard.html. But when I check in console firebase.auth().currentUser object, "displayName" and "photoURL" properies are still null.




Aucun commentaire:

Enregistrer un commentaire