快速js中的firebase googlesignin错误

问题描述 投票:0回答:1

这是当用户从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请求并获取令牌作为响应,或任何替代方式。请帮助

javascript node.js firebase express firebase-authentication
1个回答
0
投票

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

Read more here.

© www.soinside.com 2019 - 2024. All rights reserved.