我正在使用 Satellizer 登录 Facebook,除了 Facebook 不返回所有用户信息外,它运行良好。当我包含在我的范围电子邮件和 public_profile 中时,我只得到一个名字和 ID,但没有电子邮件。
这是我在客户端的 FB 配置,如您所见,我要求提供电子邮件和 public_profile:
facebook: {
clientId: 'xxxxxxx',
url: '/api/public/authentication/facebook',
authorizationEndpoint: 'https://www.facebook.com/v2.3/dialog/oauth',
redirectUri: window.location.protocol + '//' + window.location.host + '/', // window.location.origin || window.location.protocol + '//' + window.location.host + '/'
scope: 'email,public_profile',
scopeDelimiter: ',',
requiredUrlParams: ['display', 'scope'],
display: 'popup',
type: '2.0',
popupOptions: { width: 481, height: 269 }
},
在服务器上,这个:
request.get( { url: graphApiUrl, qs: accessToken, json: true }, function( err, response, profile ) { ....
只为配置文件提供 ID 和名称,如下所示:
profile = Object {name: Denis, id: xxx}
不知道我做错了什么以及为什么我没有收到电子邮件、头像...
谢谢。
最佳答案
从 Facebook API v2.4 开始,我们需要明确指定要获取的字段(例如:电子邮件)。
因此,您需要将字段作为 URL 参数,例如
"https://graph.facebook.com/me?fields=id,email,gender,link,locale,name,timezone,updated_time,verified "
关于angularjs - Satellizer Facebook 登录未返回正确的范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31502362/