我对Firebase很陌生,对Express来说有点新,我很难尝试使用Firebase提供的身份验证过程。
我有这条路线,但每次点击触发路线的按钮,我都会收到此错误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.
我很确定网络存储已启用,但我不确定如何修复location.protocol
。我做错了什么?
这是路线:
app.get('/auth/facebook', function(req, res) {
const provider = new firebase.auth.FacebookAuthProvider();
firebase.auth().signInWithPopup(provider)
.catch(err => console.log(err));
});
答案 0 :(得分:0)
试试这段代码。
var provider = new firebase.auth.FacebookAuthProvider();
Auth.$signInWithPopup(provider).then(function(authData) {
// success
}).catch(function(error) {
// error
});