Reputation: 4254
I'm making a canvas-based app for Facebook, which requires publish_stream
permissions.
At the moment, I'm checking the extended permissions in Javascript, and requesting additional permissions if necessary. However, if the user denies the request, I'm left in a funny situation where the user can see the app, but can't do anything.
I notice that lots of games have blocking dialogs on the page (not in popups) which have 'Allow' and 'Leave Application' buttons. I'd like to do something similar, to prevent users without extended permissions from entering the application.
Any idea how this is done? I'm generating the canvas page in PHP.
Thanks in advance, Ross
Upvotes: 0
Views: 870
Reputation: 6376
You need to redirect the user to:
http://www.facebook.com/connect/uiserver.php
?app_id=APPID
&next=RETURNURL
&cancel_url=CANCELURL
&perms=publish_stream
&fbconnect=0
&canvas=1
Use the javascript redirect via:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({appId: 'your app id', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
// A user has logged in, and a new cookie has been saved
} else {
top.location = "THE ABOVE URL"
}
});
</script>
Upvotes: 1