Permissions on fan page

2019-06-02 05:57发布

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条回答
女痞
2楼-- · 2019-06-02 06:24

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).

查看更多
登录 后发表回答