Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用MeteorJS、ReactJS和Facebook登录用户_Reactjs_Meteor - Fatal编程技术网

使用MeteorJS、ReactJS和Facebook登录用户

使用MeteorJS、ReactJS和Facebook登录用户,reactjs,meteor,Reactjs,Meteor,我使用了以下软件包 这将在客户端成功地从Facebook返回用户信息。我可以使用this.setUser登录该用户,但它仅针对该通信登录 我的客户端回调是 Meteor.call('users.facebookLogin', response.email, response.name, response.picture.data.url, (error, result) => { if (result) { console.log(result)

我使用了以下软件包

这将在客户端成功地从Facebook返回用户信息。我可以使用this.setUser登录该用户,但它仅针对该通信登录

我的客户端回调是

Meteor.call('users.facebookLogin', 
    response.email, response.name, response.picture.data.url, (error, result) => {
      if (result) {
        console.log(result)
        // Redirect user to homepage
      }
    })
我的meteor方法目前正在尝试这一点

Meteor.methods({
'users.facebookLogin'(email, name, picture) {
  check(email, String)
  check(name, String)
  check(picture, String)

  let user = Accounts.findUserByEmail(email)

  if(user) {
    this.setUser(user._id)
  }
},
})

这会让用户登录,但如果刷新浏览器,用户必须再次登录。我希望用户以与Meteor.loginWithPassword相同的方式登录。

您检查过了吗?它通常处理您需要的一切,如存储令牌、使用令牌保持重新登录以及当前用户的会话处理。是的,这是正确的@Jankapunkt我尝试以错误的方式执行此操作,而不是启动Meteor的按钮。loginWithFacebook()是正确的。