Skip to content
Advertisement

Firebase Database console.log() returning Null in Javascript

I hope to seek help from someone if possible. In the following code. Im trying to console.log() data from My Firebase reference as you can see in my code below. But the Console.log() is returning null instead of the values that are there in Firebase Realtime Database. I have also provided the code for adding which is working well. Please have a look the image of my database if it helps. I am not getting any other error in my console except the fact that this is returning null. enter image description here

JavaScript

Advertisement

Answer

When loading the page for the first time, firebase.auth().currentUser shouldn’t be used because Firebase Auth needs to check if the user’s login session is valid first.

JavaScript
Advertisement