为什么Facebook登录API不要求访问电子邮件?

问题描述 投票:0回答:1

伙计们,我有一个自定义按钮,它会触发FB.login()事件,但是我无法获取电子邮件信息,facebook不会要求用户访问电子邮件并返回nameid字段

FB.login(function(response) {
  console.log(response)
  if (response.authResponse) {
    FB.api('/me?fields=id,name,email', function(data) {
      console.log(data)
      if ((typeof data.email === 'undefined') ||(data.email == '') || (data.email == null)) {
        M.toast({html: "You dont't give an email access, we are can't register you without email. Sorry :("});
          return false;
       }
       window.flags.signin = {
         status: true,
         name_surname: data.name,
         email: data.email,
         login_type: 'facebook',
         id: data.id
       }
      // back-end request func   
      window.flags.submitFunc('veriler='+JSON.stringify(window.flags.signin));
    }, { scope: 'id,name,email'});
  }
  else {
    M.toast({html: 'User cancelled login or did not fully authorize.'});
  }
});
javascript facebook-javascript-sdk facebook-login
1个回答
0
投票

修复它,我改变这条线

{ scope: 'id,name,email'}

to

{ scope: 'email'}

开始询问电子邮件访问权限

© www.soinside.com 2019 - 2024. All rights reserved.