用firebase auth和express对社会登录进行认证



我是Firebase的新手,并且有点新来,并且我很难使用身份验证过程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.

我很确定已启用Web存储,但是我不确定如何修复location.protocol。我在做什么错?

这是路线:

app.get('/auth/facebook', function(req, res) {
  const provider = new firebase.auth.FacebookAuthProvider();
  firebase.auth().signInWithPopup(provider)
    .catch(err => console.log(err));
});

这是完整的firebase应用

尝试此代码。

var provider = new firebase.auth.FacebookAuthProvider();
Auth.$signInWithPopup(provider).then(function(authData) {
    // success
}).catch(function(error) {
    // error
});

最新更新