Satellizer Facebook登录未返回正确的范围 [英] Satellizer Facebook login not returning the right scope
问题描述
我正在使用Satellizer进行Facebook登录,除了Facebook不会返回所有用户信息外,它的工作原理非常好.当我插入作用域电子邮件和public_profile时,我只会得到名称和ID,而没有电子邮件.
I'm using Satellizer to do a Facebook login, it works great except that Facebook is not returning all the users info. I'm only getting a name and ID but no email when I inculde in my scope email and public_profile.
这是我在客户端上的FB配置,如您所见,我正在询问电子邮件和public_profile:
Here is my FB config on the client side, and as you can see, I'm asking for email and 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和名称,如下所示:
Only gives for the profile the id and name like so:
profile = Object {name: Denis, id: xxx}
不知道我在做什么错,为什么我没有收到电子邮件,头像...
No idea what I'm doing wrong and why I'm not getting the email, the avatar...
谢谢.
推荐答案
从Facebook API v2.4中,我们需要显式指定要获取的字段(例如:电子邮件).
From Facebook API v2.4, we need to explicitly specify fields(ex:email) to get.
因此,您需要将字段作为URL参数,例如
So, you need to have fields as URL parameter like
" https://graph.facebook.com/me?fields=id,电子邮件,性别,链接,语言环境,名称,时区,更新时间,已验证"
这篇关于Satellizer Facebook登录未返回正确的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!