I have few problems. When I need an application to ask the user for permissions for the application, I use the following code:
<?php $loginUrl = $facebook->getLoginUrl( array( 'canvas' => 1, 'fbconnect' => 0, 'scope' => 'email,publish_stream,offline_access', )); ?> echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
I am working fine, but after the user clicks “grant permissions”, he is redirected to my application URL. I mean http://mydomain.com/myapp/ directly, not the page of my application on Facebook. I can get around this - I know my Facebook address, so I redirect it to the correct http://apps.facebook.com/myappname . It works fine too. BUT - when someone adds my application to the tab of a page - there is a problem. Because I don’t know where to redirect the user anymore - I don’t know which page my application was called from.
Is there any way to find out which page my application was called from or, even better, make Facebook correctly redirect the user to the facebook page, where the application tab is added after the "permission to access" dialog?
source share