Facebook oauth login not returning email

早过忘川 提交于 2019-12-11 19:24:37

问题


I am using this plugin for oauth login, here is my FB response while doing aouth login:

{"state":"","access_token":"XYZ","expires_in":5110943,"client_id":"CLIENT ID","network":"facebook","display":"popup","redirect_uri":"http://localhost/XYZ123/www/callback.html","scope":"email,basic","expires":1439628780.389}}

The problem is i am not getting email of user. As per other SO solutions :

I have verified email so that should not be a matter. I am not getting FB message regrading verifying email.

Here is output of CLIENT ID/permissions

{
  "data": [
    {
      "permission": "email", 
      "status": "granted"
    }, 
    {
      "permission": "public_profile", 
      "status": "granted"
    }
  ]
}

回答1:


You need to make an API call to get the users profile. Email is not included in the authResponse object.

var fb = hello('facebook');
fb.login({scope:'email'}).then(function(){
   return fb.api('me');
}).then(function(res){
   // do something with res.email
}, console.error.bind(console) );



回答2:


email

Provides access to the person's primary email address via the email property on the user object.

Do not spam users. Your use of email must comply with both Facebook policies and with the CAN-SPAM Act.

Note, even if you request the email permission it is not guaranteed you will get an email address. For example, if someone signed up for Facebook with a phone number instead of an email address, the email field may be empty.

Review Your app may use this permission without review from Facebook.



来源:https://stackoverflow.com/questions/30883022/facebook-oauth-login-not-returning-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!