使用Firebase Auth和Express验证社交登录?

时间:2017-09-14 23:15:22

标签: node.js express firebase firebase-authentication

我对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));
});

Here's the full Firebase app

1 个答案:

答案 0 :(得分:0)

试试这段代码。

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