getting a unique userid from facebook login
so supposed I added the facebook login button as specified in this site:
http://developers.facebook.com/docs/reference/plugins/login/
by adding this code:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&xfb开发者_如何学Goml=1">
</script>
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
of course with my own appid and stuff
when I do that if someone access the site while logged in through facebook, it will say that he's currently logged in...
how do I go about retrieving some sort of unique user identification from the logged in person in my site through PHP? I just need one simple unique identification string of the logged in individual, nothing fancy, so I'm hoping that it would be some sort of one liner thing
Use the PHP SDK - https://github.com/facebook/php-sdk
The example.php
file has pretty much everything you need to know.
When you login from login button of facebook then it stores cookies in your system that contains your access token that is also unique. That cookies contains your facebook id also.
I think that just opens an iframe that runs facebook code that looks for facebook cookies of the user. You are not supposed to be able to get at that info, without, as implied above, getting permissions from the user.
精彩评论