开发者

Make granting extended permission optional for an application?

I'm developing a Facebook canvas application. One of the features in this application will be posting to the user's stream when they perform certain actions, i.e. logging into the app ("User X is now playing at App Y!"), purchasing a virtual product ("User X has just purchased Product Y on App Z!") etc. To do this, I need the "publish_stream" extended permission. However; I want this to be optional.

Previously, I used the following method from Facebook's old REST API:

$user = $facebook->require_login('email,publish_stream');

But this denies access to the appl开发者_如何学JAVAication if the user doesn't grant the "publish_stream" permission. The problem being, my manager wants this to be optional; if they don't have the permission then don't post to the stream.

Is it possible to make granting extended permissions optional? Or is it black-and-white, "if you don't grant us this extended permission then you can't play"?

Thanks in advance.


You can do this via the new Javascript SDK:

FB.login([callback_function], { perms: 'email,publish_stream' });

More info here: FB.login

Be aware, however, that FB strongly frowns upon the kind of "X is playing Y" publishing you're after: Facebook Stream Stories

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜