Redirect problem after FB.Connect.showPermissionDialog

I am creating a facebook connection application for publishing content to user threads. To do this, I need to get extended publish_stream permission from users. I am using function code for this.

Check connection status

<input type="button" onclick="statusSubmit('Permission to publish : ');" value="Check connection status" />

<script type="text/javascript">
function statusSubmit(status)
{
    facebook_prompt_permission('publish_stream', function(accepted)
    {
        if(accepted) {
            // User (already) has permission
            alert(status + 'already granted');
        }
        else
        {
            //  User does not have permission
            alert(status + ' not granted');
        }
    });
}

function facebook_prompt_permission(permission, callbackFunc)
{
    // Check if user has permission, if not invoke dialog.
    FB.ensureInit(function() {
        FB.Connect.requireSession(function(){
            //check is user already granted for this permission or not
            FB.Facebook.apiClient.users_hasAppPermission(permission,
            function(result) {
                // prompt offline permission
                if (result == 0) {
                    // render the permission dialog
                    FB.Connect.showPermissionDialog(permission,
                    function(result){
                        if (null == result)
                            alert('no permissons granted');
                        else
                            alert('permissions ' + result);
                    }, true, null);
                } else {
                    // permission already granted.
                    callbackFunc(true);
                }
            });
        });
    });
}
</script>

After the rights dialog box opens and the user grants permissions, redirecting my current page to my local development machine. According to my settings, I cannot control this redirection behavior. I tried changing the "Post-Authorize Callback URL" to a public page, but it is not called. Is there something I'm missing? I would like either

  • Get the callback url after authorization for something that works OR
  • , , . .

.

+3
2

abronte, . , xd_receiver.htm , . , . API- FB Javascript , , . .

+1

, URL- , , . URL- facebook.

, ( , ), - .

window.location = '/path/to/something';
0

Source: https://habr.com/ru/post/1717098/


All Articles