As mentioned in the title, I have an app and when the auth dialogue is shown requesting permissions, regardless of whether the Allow
or Don't Allow
button is clicked by the user they are still redirected to the app canvas page.
I understand it's to do with the redirect_uri
but is there a way to differentiate between the two actions to execute different logic based on the button that is clicked?
// Login or logout url will be needed depending on current user state.
else {
$loginUrl = $facebook->getLoginUrl(array('canvas' => 1,
'fbconnect' => 0,
'display' => 'page',
'redirect_uri' => 'https://www.facebook.com/dialog/oauth?client_id=xxxxxxxxx&redirect_uri=http://www.domain.com/facebook/2011/app1/redirect.php&scope=publish_stream',
'req_perms' => 'publish_stream'));
redirect.php
on my domain simply redirects back to the app.
Thanks for any help!
It will redirect to the same url regardless of what button is pressed in the auth dialog, but with different GET parameters:
If the user denies your app access, it should put the following params in the url
You need to handle this in your redirect page.
if(isset($_GET['error']))
{
die($_GET['error_description']);
}
else
{
// ... redirect as usual
}