how to get user permission using facebook overly box

While working on facebook i had one condition where in my facebook applied need user email id and publish rights. How to get user permission using facebook overly box was little challenge for me, I had to play and check on how to enforce user and give the permission. Show next pages to the user only if user provides required permission like email and publish stream, etc. This code is recursive activity that enforces users. This code performs FB.ui call back.

%MINIFYHTMLb308dab990d89474796e8e48668c750f5%
FB.init({ appId: '< ?php echo APP_ID ; ?>',
	    status: true,
	    cookie: true,
	    xfbml: true,
	    oauth: true});
var stopChecking = 0;
function getUserPermission() {
  // alert( "One" + stopChecking);
 FB.ui({
        client_id: '< ?php echo WELCOME_APP_ID ; ?>',
        method: 'oauth',
        display: 'popup or iframe - both dont work',
        scope: 'email,user_birthday,publish_stream,user_groups,offline_access',
        perms: 'publish_stream,email'
    }, function(response) {
   if(response.perms) {
      if ((response.perms.indexOf("email") > -1)  && (response.perms.indexOf("publish_stream") > -1) ) {
          stopChecking = 1;
	  // alert('User Approved Permission.');
       } else {
         getUserPermission();
       }
    } else {
	   getUserPermission();
      	  //alert('User cancelled login or did not fully authorize.');
    	}
     }
  );
}
getUserPermission();
Share this nice post:

2 thoughts on “how to get user permission using facebook overly box

  1. Tremendous! This particular is all I can think pertaining to a blog post like this excellent. This kind of is literally a notably explanatory article post on the blog. You just need to know a lot about this amazing.

Leave a Reply

Your email address will not be published. Required fields are marked *