Dialog:permissions.request
From Facebook Developer Wiki (FbDevWiki.com)
If you need to get extended permissions from a logged in user without having to redirect them back to the login URL, this is the way to do it.
| Property | Type | Description | Argument | Possible Values / Examples |
|---|---|---|---|---|
| method | String | The UI dialog to invoke. | Required | 'permissions.request'
|
| perms | comma deliminated string | list of permissions to be requested | Required? | Ex. 'user_birthday,user_relationship_details,read_stream'
see Extended Permissions for list of possible values |
Example permissions.request using JavaScript SDK dialog:
FB.ui({
method: 'permissions.request',
'perms': 'user_birthday,user_relationship_details,read_stream',
'display': 'iframe'
},
function(response) {
// check response.perms that it has all the required permissions... if so, continue to next page.
// TODO should be a better way to do this since UI checks perms
if (response.perms != null && isSetProperSubset(permissions.split(","), response.perms.split(","))) {
top.location.href = "http://apps.facebook.com/fbdevwiki/"+nextUrl;
}
}
);
function isSetProperSubset(subset, superset) {
// first check lengths
if (subset.length > superset.length) {
return false;
}
var lookup = {};
for (var j in superset) {
lookup[superset[j]] = superset[j];
}
for (var i in subset) {
if (typeof lookup[subset[i]] == 'undefined') {
return false;
}
}
return true;
}