I have this in my header:
<script src="http://connect.facebook.net/en_US/all.js"></script>
Then I have the FB login button code like this:
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=myAppId&xfbml=1">
</script><fb:login-button show-faces="false" perms="user_hometown,user_about_me,email,user_address"
autologoutlink="true" width="200" max-rows="1">
</fb:login-button>
Then after the user logs in with the FB button, how do I make a JS call to get their name, email, photo, etc?
I also found some code like this, but not sure where this is used:
<script>
FB.init({
appId : 'myAppId',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelURL : 'http://www.comehike.com/channel.html', // channel.html file
oauth : true // enable OAuth 2.0
});
</script>
Do I need the code right above?
Thanks!!
To get logged users data:
If all went well
responseshould be a JSON object containing the user data you have permission to view.The users image can be gotten from:
You can specify the size you want with the type argument
For example: