Chris Abrams
Chris Abrams

Reputation: 42390

How to get a Facebook user's ID?

I followed this tutorial: http://developers.facebook.com/docs/authentication/ on how to setup Facebook authentication using php (server-side implementation). I can get a access token back from Facebook but how do I get the Facebook user ID of the user who has logged in?

Upvotes: 4

Views: 375

Answers (3)

racitup
racitup

Reputation: 454

If you're looking for a quick non-programatic way of getting your user-id, it's in your browser cookie called c_user I believe

Upvotes: 0

fingerman
fingerman

Reputation: 2470

You should use facebook PHP SDK: https://github.com/facebook/php-sdk/

See the example file in order not to get Lost... https://github.com/facebook/php-sdk/blob/master/examples/example.php

Facebook graph API is kinda annoying... so using this will be easier (at least for me)

Upvotes: 2

Anomie
Anomie

Reputation: 94794

The easiest way, if your framework/sdk/whatever doesn't provide it for you, would be to query https://graph.facebook.com/me?fields=id&access_token=....

Upvotes: 2

Related Questions