You Are Here: Home » Facebook » How-To » Programming

How To Get Logged In / Current Facebook User’s ID On Iframe Page Tabs?

By Debjit on March 25th, 2013 

Facebook recently announced that it would no more support new FBML (Facebook Markup Language) based applications. Accordingly the option to create new FBML apps on Facebook has now been removed and developers can now create only Iframe based applications on Facebook. Static FBMLs have been also deprecated to a great extent.

One method of interacting with users on Facebook used by many brands is the Fan Page tab by getting the currently logged in Facebook user's ID. However with new Iframe fan page tabs, the method is a bit different. In this article we will tell you how to get the Logged In / Current Facebook User's ID on Iframe page tabs.

The idea behind getting the logged in user's Facebook ID is to make him / her interact with the page. We do this by showing a Permissions or App login dialog using FB.Login from the Facebook Javascript SDK. When the user accepts the permissions, the FB.Login method returns an access token which can be used to query the Facebook database via the Graph API. Here is the full code for the same.

You can check out a live demo here:

You can read more Facebook API Development articles on this page. If you are facing any problem with the implementation do write to me at: [email protected]. You can also hire me for developing Facebook applications for you.

Let us know in the comments section if you face any problems.


How To Get Logged In / Current Facebook User’s ID On Iframe Page Tabs? was originally published on on May 20, 2011 - 6:27 pm (Indian Standard Time)