开发者

Request for permission doesn't work !

I have added this code on the top of my PHP script:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>


FB.init({appId: 'myAppId', status: true, cookie: true, xfbml: true});

FB.login(function(response) {
  if (response.session) {
    if (response.perms) {
      // user is logged in and granted some permissions.
      // perms is a开发者_Go百科 comma separated list of granted permissions
    } else {
      // user is logged in, but did not grant any permissions
    }
  } else {
    // user is not logged in
  }
}, {perms:'read_stream,publish_stream,offline_access'});



</script>

But it doesn' t work !! Why ??


Facebook doesn't allow conventional JavaScript in canvas applications.

If you're using PHP, try the REST API which has methods for obtaining extended permissions. For example, in my global include file I have the following line:

// require login
$user = $facebook->require_login('read_stream,publish_stream,offline_access');

This only permits access to my application if the user grants me the specified extended permissions.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜