How to get User id by username in Facebook Graph A

2020-02-12 13:47发布

问题:

we are developing a web app and were getting the user ids by using the username via FQL. Unfortunately, Graph API v2.1 does not support FQL anymore. I haven't found a way how to reference the username to find the user id in the documentation.

Is there a solution? Or is that not possible with the Graph API. I know that I can query the user ID using the name, but with the username, it would be better in our scenario.

回答1:

This is intentional for privacy reasons. If you would be able to get the (real) User ID with the unique username, there would be no need to invent App Scoped ID at all.

If you make a call to /me/username, it will return the following error:

(#803) Cannot query users by their username

Btw, you cannot even get the username since v2.0, only the real name.