If I have a page that can only be accessed by authenticated users, how do I check if a user is authenticated or not?
I tried using (firebase.auth().currentUser !== null)
but I am getting an error saying: TypeError: firebase.auth is not a function
I have the following configuration:
const express = require('express'),
firebase = require('firebase'),
app = express();
app.use(express.static("/public"));
var config = {
apiKey: "xxxx",
authDomain: "xxxx",
databaseURL: "xxxx",
projectId: "xxxx",
storageBucket: "xxxx",
messagingSenderId: "xxxx"
};
firebase.initializeApp(config);
app.get("/dashboard", (request, response) => {
if (firebase.auth().currentUser !== null){
response.render("dashboard.ejs")
}
else{
response.render("login.ejs");
}
});