Facebook Canvas Apps, New API
I'm having some trouble with switching to the new JS API for a number of things with creating applications within FB, specif开发者_如何转开发ically the "Tab".
<!--
function do_perm()
{
Facebook.showPermissionDialog('publish_stream,email,offline_access', null);
}
//-->
This no longer works for me when called via an onclick command. Also, with the new API and an FBML app. How does this exactly work? The documentation is really poor so I am confused when looking at the old wiki, and the new developer site.
Apologies for being pretty vague, but I'm just generally confused with the lack of clear direction with the new API and help would be greatly appreciated.
I'm simply just trying to create a call that prompts for the new style user permission dialog, and oncomplete calls another JS function.
function do_permission(perms) {
Facebook.showPermissionDialog(perms, done_permissions);
}
function done_permissions(permission_granted) {
//new Dialog().showMessage("Message", "Bo!","Ok");
}
function do_ajax(type, val) {
var ajax = new Ajax();
ajax.responseType = type;
ajax.onerror = function(error) {
new Dialog().showMessage("Message", "Ajax Error", "Ok");
};
ajax.ondone = function(data) {
new Dialog().showMessage("Message", "Ajax Success", "Ok");
do_permission('publish_stream,email,offline_access,user_location,user_hometown');
}
var params = { 'key1': type, 'key2': val };
ajax.requireLogin = true;
ajax.post('http://example.com', params);
}
- I am able to auth the user when they run do_ajax, but this doesn't then go onto call extended permissions.
- Extended permissions are only run once the Tab app is reloaded, and then they can grant them. This isn't desirable as a user isn't likely ot reload the app, then click again.
- Am I able to do this all in one?
If you meant a tab on the fan page, i recently created one here:
http://www.facebook.com/apps/application.php?id=115400635147687&v=app_115400635147687
with the help of this tutorial:
http://www.slideshare.net/onitz/fancy-facebook-fan-pages-a-step-by-step-guide
You should see the section in it:
Creating a simple App.
If you're developing application using new php sdk or javascript sdk from facebook, then you can provide the permissions list at the time of authentication.
Checkout my article: http://thinkdiff.net/facebook/graph-api-javascript-base-facebook-connect-tutorial/
精彩评论