Get Logged-In User

Problem

I need to find the current loggedinuser’s uid.

Solution

Use the very simple Users.getLoggedInUser() method:

$currentUser = $facebook->api_client->users_getLoggedInUser();

Discussion

Users.getLoggedInUser() returns the uid of the current loggedinuser.

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.