如果用户删除了我所需要的任何许可,我想将用户转至 o页。
出于某种原因,在我试图从FB.api呼救功能中转出时,以下的法典造成了无休止的漏洞。 我如何解决这一问题的想法?
var perms = [ publish_actions , email , user_birthday , user_location ],
permsString = perms.join( , ),
permissionsUrl = https://www.facebook.com/dialog/oauth ;
permissionsUrl += ?client_id= + config.facebook.appId;
permissionsUrl += &redirect_uri= + encodeURI(canvasUrl);
permissionsUrl += &scope= + permsString;
FB.getLoginStatus(function (response) {
if (response.status === connected ) {
FB.api( /me/permissions , function(response) {
// using underscore here...
var keys = _.keys(response.data[0]),
diff = _.difference(perms, keys);
// send the user through the auth again if they ve removed any of the perms we need
if (diff.length) {
window.location.href = permissionsUrl; // results in an endless redirect loop
// window.location.href = http://randomwebsite.com ; // does redirect successfully!!!!
}
});
}
}, true);