Express js中的firebase googlesignin错误

时间:2019-01-06 18:02:20

标签: javascript node.js firebase express firebase-authentication

这是当用户单击html页面中的按钮时调用的函数。

此函数在auth.js中,在server.js页面中调用

auth.js

 const firebase = require("firebase");
 static googleSignIn(req,res){      

    firebase.auth().signInWithPopup(new firebase.auth.GoogleAuthProvider()).
    then( (result) => {
        console.log(result.credential.idToken);
        firebase.auth().currentUser.getIdToken(true).then( (token) => {
            console.log(token);
        });

    }).catch((err) => {
                console.log(err);
            });

}

我收到此错误

code: 'auth/operation-not-supported-in-this-environment',
message:
'This operation is not supported in the environment this application is 
running on. "location.protocol" must be http, https or chrome-extension and 
web storage must be enabled

有什么方法可以发送html请求并获得令牌作为响应,或者有其他方法。请帮助

1 个答案:

答案 0 :(得分:0)

该错误消息试图告诉您Firebase身份验证客户端库在node.js环境中不起作用。仅Web浏览器客户端支持它们。

Read more here.