Если у меня есть страница, доступ к которой имеют только аутентифицированные пользователи, как я могу проверить, аутентифицирован ли пользователь или нет?
Я попытался использовать (firebase.auth().currentUser !== null)
, но получаю сообщение об ошибке: TypeError: firebase.auth is not a function
У меня есть следующая конфигурация:
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");
}
});