Node.js不支持Firebase身份验证

时间:2018-12-13 11:06:57

标签: node.js firebase firebase-authentication

我试图在nodejs中将firebase作为firebase文档的电子邮件和密码验证正常运行,但是当我使用类似google的提供程序auth时,会向我显示此消息

  

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

这是我的代码

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

firebase.auth().signInWithPopup(provider).then((result) =>{
    var token = result.credential.accessToken;
    var user = result.user;
    console.log(token,user)

  }).catch(function(error) {
    console.log(error)
  });

})

请引起您的注意,我有http://localhost:3000这样的服务器,并从浏览器和角度服务器调用api http://localhost:3000/signin/google,在两种情况下都给我相同的消息

0 个答案:

没有答案