views:

23

answers:

1

Hello,

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 application 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.

A: 

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

Josh Wolf
I would advise against it too, but that's the joys of working as a web developer for a marketing agency where it's their way or the highway!
Martin Bean