问题描述
我正在尝试使用 Facebook 登录 - 到目前为止一切正常,除了我返回的 $user 数据不包括用户名(我知道确实存在).
I am trying to implement a login with Facebook - thus far all is working, apart from the $user data I am being returned does not include the username (which I know does exist).
我返回的数组如下(详细信息已清除):
The array I am being returned is the following (with details purged):
Array ( [id] => ################ [email] => #.########@#####.co.uk [first_name] => ######## [gender] => male [last_name] => ######## [link] => https://www.facebook.com/app_scoped_user_id/################/ [locale] => en_GB [name] => ######## ######## [timezone] => 1 [updated_time] => 2014-05-06T21:23:33+0000 [verified] => 1 )
有没有人有过这样的经历?
Has anyone had experience of this before?
推荐答案
username
字段已在图形 API 2.0 版中删除.我不知道有什么解决方法(没有使用 1.0 版).
The username
field was removed in version 2.0 of the graph API. I'm not aware of any workaround (short of using version 1.0).
此更改列在升级指南的已删除端点"部分.您还可以看到用户"参考没有提及2.0 版的 username
字段,但 适用于 1.0 版.
This change is listed in the "Removed Endpoints" section of the upgrade guide. You can also see that the "User" reference contains no mention of a username
field for version 2.0, but does for version 1.0.
并非所有字段都可通过 API 获得.使用我上面提供的参考资料,您可以准确地看到哪些字段可用.
Not all fields are available through the API. You can see exactly what fields are available using the references I've provided above.
这篇关于Facebook api('/me') 不返回用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!