How to get a Facebook user's ID?
I followed this tutorial: http://developers.facebook.com/docs/authentication/ on how to setup Facebook 开发者_如何学JAVAauthentication 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?
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)
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=....
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
精彩评论