这是当用户从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请求并获取令牌作为响应,或任何替代方式。请帮助
该错误消息试图告诉您Firebase身份验证客户端库在node.js环境中不起作用。它们仅支持Web浏览器客户端。