简体   繁体   中英

Javascript API Get Username

Is it possible to get an username of a specific user if this user has one. Do I need extended permissions from the user to do so?

The user accepted my app and I already get the name, first_name and last_name. But the username is missing. Something I forgot?

Thank you very much!

Greetings Sylar

If you query the Graph API with http://graph.facebook.com/USERID you will get:

"id": "USERID",
"name": "NAME",
"first_name": "FirstNAME",
"last_name": "LASTNAME",
"link": "LINK",
"username": " THETHINGYOUWANT ",
"gender": "GENDER",
"locale": "LANGUAGE"

So you should not need anything else, and the documentation also tells that you don't need an access_token to get it. http://developers.facebook.com/docs/reference/api/user/

并非每个用户都有一个用户名,这就是为什么有时您不会看到返回或填写的“ username”属性的原因。但是此字段包含在基本权限中,因此您无需请求其他任何内容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM