Facebook api('/me') not returning username

被刻印的时光 ゝ 提交于 2019-12-12 10:16:46

问题


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?


回答1:


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).

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.

Not all fields are available through the API. You can see exactly what fields are available using the references I've provided above.




回答2:


Looks like a Facebook Graph API bug.



来源:https://stackoverflow.com/questions/23663126/facebook-api-me-not-returning-username

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