Hello i'm trying to use facebook showPermissionDialog to get user datas
this is my code
function switch_menu(element, id) {
var ajax = new Ajax();
Facebook.showPermissionDialog('manage_pages,offline_access,email,publish_stream,user_photos,user_birthday')
ajax.responseType = Ajax.FBML;
ajax.ondone = function(data) {
document.getElementById('topic_loading').setInnerFBML(data);
}
ajax.onerror = function() {}
ajax.post('#{oauth_authorize_url(开发者_StackOverflow社区:canvas => false, :format => :js)}')
}
The dialog is opening very well, my question is how to get the user data after that the user has accepted the conditions.
thx
I guess you have already found the soln to this. Just in case here it is:
Facebook.showPermissionDialog("bla,bla,bla permissions", FacebookPermissionHandler);
function FacebookPermissionHandler(handler)
{
new Dialog().showMessage('Okay.', ""+handler);
//handler contains allowed permission(s) [comma seperated] from the user.
}
FB documentation actually explains this.
Please double check the documentation if you cant get this to work.
There is a bug in Facebook.showPermissionDialog() which causes Ajax requests silently fail after user gives you the permissions. Since you are already asking for extra permission you can set ajax.requireLogin to false. This should fix the Ajax request.
function switch_menu(element, id) {
var ajax = new Ajax();
Facebook.showPermissionDialog('manage_pages,offline_access,email,publish_stream,user_photos,user_birthday')
ajax.responseType = Ajax.FBML;
ajax.requireLogin = false;
ajax.ondone = function(data) {
document.getElementById('topic_loading').setInnerFBML(data);
}
ajax.onerror = function() {}
ajax.post('#{oauth_authorize_url(:canvas => false, :format => :js)}')
}
精彩评论