[Facebook] Obtaining your User ID

Your own Facebook User ID is required in many places, like setting admin ID on your page’s OpenGraph tags. Most of advice available on the web regarding getting your own Facebook ID suggest looking at links on your profile page, but that kind of advice is usually outdated and unusable if you have vanity URL (your username replaced user ID in URLs). You can look into the profile page source and bash through tons of code, and yes, you can find it looking for some strings inside the source code, like it’s pictured on a screenshot. But it’s a tedious job, and there are more elegant ways.

Specifically, you can use OpenGraph API Explorer, available here. Input field is already prepopulated with me value, that obviously tells the Explorer to show data for currently logged in user. But before this could work, you have to authorize API Explorer to access your data by clicking Get access token button, choosing minimal permissions (user_about_me is definitely enough – see this screenshot), and authorizing the application in a standard way, like any other with Facebook.

After granting permissions, Access Token field is populated automatically, and you can clickSubmit button to get information about your user. User ID will be the first field.

When you have your user ID, you can check if it’s a proper one on the same page – just enter your ID instead of me and hit Submit – you should see your basic data.

Leave a Reply

Your email address will not be published.