Im’ trying to let a user authenticate on facebook and show his list of pages that can be managed. This worked fine, but since a week or two, facebook needs a permission called “manage_pages”.
I’m trying to ask for this permission and came up with the solution below. It works, but the problem is that my second popup (second part of the code) that asks for maange_pages permissions is blocked by most browsers, since the popup isn’t triggered by a user action like clicking on a button.
The first popup (logging into facebook) shows up fine.
How can I solve this so that the second popup isn’t blocked. Maybe there is a way to show ask for manage_pages permissions in one step instead of doing it my way below.
FB.init({
appId : '...',
session : ..., // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('auth.login', function() {
FB.login(function(response) {
if (response.session) {
if (response.perms) {
window.location.reload();
} else {
window.location.reload();
}
} else {
window.location.reload();
}
}, {perms: 'manage_pages'});
});
I solved it like this:
UPDATE: Facebook changed perms to “scope”