此环境不支持Firebase身份验证操作

时间:2018-12-06 14:27:08

标签: node.js angular firebase firebase-authentication

我正在尝试使用Google Firebase的身份验证提供程序,并且使用了nodejs函数。

这是我的代码

router.get('/signin/google', (req,res,next)=>{
    var provider = new firebase.auth.GoogleAuthProvider();

    firebase.auth().signInWithPopup(provider).then((result) =>{
        // This gives you a Google Access Token. You can use it to access the Google API.
        var token = result.credential.accessToken;
        // The signed-in user info.
        var user = result.user;
        console.log(token,user)
        // ...
      }).catch(function(error) {
        // Handle Errors here.
        var errorCode = error.code;
        var errorMessage = error.message;
        console.log(errorCode,errorMessage)
        // ...
      });
})

我从这样的角度称这条路线

this.http.get('http://localhost:3000/auth/signin/google').subscribe(data=>{
            console.log(data)
        });

我收到此错误

  

此环境不支持身份验证/操作。在运行此应用程序的环境中不支持此操作。 “ location.protocol”必须为http,https或chrome-extension和Web   存储必须启用。

我已经在nodejs服务器上运行了Firebase,并且从http://localhost:3000/auth/provider/google上的角度访问了

0 个答案:

没有答案
相关问题