Permissions on fan page

守給你的承諾、 提交于 2019-12-23 03:53:27

问题


How do I get permission on an application I have on a fan page tab and stay on the current tab?

I am collecting permissions on the application fine, but when I put the application onto a tab, it goes haywire seemingly getting caught in a never-ending loop and never going anywhere.


回答1:


You could do this with the JavaScript SDK:

//Facebook connection with the JavaScript SDK
FB.init({
    appId: 'YOURAPPID', 
    cookie: true, 
    xfbml: true, 
    status: true });

FB.getLoginStatus(function (response) {
    //If you have permissions already
    if (response.session) {
        //Do application stuff...
    } 
    else {
        //Redirect browser to the permission dialogue
        top.location="https://www.facebook.com/connect/uiserver.php?app_id=YOURAPPID&method=permissions.request&display=page&next=REDIRECTPAGEURI&response_type=token&fbconnect=1&perms=email,read_stream,publish_stream,offline_access";
    }
});

You put in your application ID in the fb.init function, and then adjust the redirect for the permissions dialogue so it includes your application ID, the URI you want to re-direct to after the user accepts the permission dialogue, and finally the permissions you want to get (in this case I included email, read stream, publish stream and offline access token).



来源:https://stackoverflow.com/questions/7393037/permissions-on-fan-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!