i am creating login code for facebook connect on our site, however i cannot find how to check if the user has the required permissions.
with the old javascript, one dialog would be opened for each permission and the return code would say if the permission was accepted or not, how does it work with the javascript code?
here is the code i got so far, with the TODO where i want to check if the user has got permissions
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'MY API KEY', status: true, cookie: true,xfbml: true});
FB.Event.subscribe('auth.login', function(response) {
alert("logged in");
//TODO: check if all perms has been accepted!!!!
//if they have NOT been accepted, I want to logout the user
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, again, check if all perms has been accepted
alert("already logged in");
}
});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:login-button perms="email,user_birthday,status_update,publish_stream" >Login with Facebook</fb:login-button>
btw, in the documentation they have this example http://developers.facebook.com/docs/reference/javascript/FB.login
where they use custom buttons, that's why i suspected that there would be something similar for the fb:loginbutton