Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Nodejs+;Firebase身份验证_Node.js_Firebase_Firebase Authentication - Fatal编程技术网

Node.js Nodejs+;Firebase身份验证

Node.js Nodejs+;Firebase身份验证,node.js,firebase,firebase-authentication,Node.js,Firebase,Firebase Authentication,我已经在我的node js passport应用程序中添加了firebase身份验证,以便更轻松地使用Google登录,以下脚本仅允许用户在经过身份验证的情况下访问仪表板页面,但无法使用Google身份验证,有人能帮我吗 const firebase = require("firebase/app"); require("firebase/auth"); const firebaseConfig = { apiKey: "x", authDomain: "x", databaseU

我已经在我的node js passport应用程序中添加了firebase身份验证,以便更轻松地使用Google登录,以下脚本仅允许用户在经过身份验证的情况下访问仪表板页面,但无法使用Google身份验证,有人能帮我吗

 const firebase = require("firebase/app");
 require("firebase/auth");

 const firebaseConfig = {
 apiKey: "x",
 authDomain: "x",
 databaseURL: "x",
 projectId: "x",
 storageBucket: "x",
 messagingSenderId: "x",
 appId: "x",
 measurementId: "x"
};
firebase.initializeApp(firebaseConfig);

  module.exports = {
  ensureAuthenticated: function(req, res, next) {
    firebase.auth().onAuthStateChanged(user => { 
    if(req.isAuthenticated()){
        return next();
    } else if (user) {
        return next();
    } else {
    req.flash('error_msg', 'Please log in to  view this page');
    res.redirect('/users/login')
    }})}}