2017-09-14 184 views
1

我对Firebase颇为陌生,对Express也稍微有点新,我很难尝试使用Firebase提供的身份验证流程。使用Firebase身份验证和Express身份验证社交登录?

我有这条路线,但每次我点击触发路由的按钮,我得到这个错误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

+0

是你的平板IOS或Android或两者都不? – turmuka

+0

@turmuka既不是,它是一个节点快车应用程序。 – Zevoxa

回答

0

尝试这段代码。

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

看起来像Angular代码。我目前没有使用Angular,因为我正在使用Firebase进行测试并尝试熟悉。截至目前,它的唯一表达和firebase。 – Zevoxa

+0

您用于Firebase的版本是什么? @Zevoxa – turmuka

+0

最新的npm,4.3.1。我通过指向完整应用程序代码的链接更新了问题。 – Zevoxa