I’m developing a site and I put the Facebook Connect using PHP SDK 3.
The problem is that the page where Facebook returns the results after the user authenticates and grants permission. For me after a user clicks "allow", it authenticates and then returns back to the same page (index) with a query string.
What I want is that if the user clicks "don’t allow", he will be redirected to a certain page like login-fail.php, and if he grants permission he is redirected to login-success.php where his data will be processed and stored in the database.
Any ideas?
You cannot specify a redirect URL in case of error. The best you can do is to set a redirect URL that will be the same for success or error :
If the user clicks “Don’t allow”, he will be redirected to the page
after-dialog.phpwith the following GET parameters :If you really want to redirect him according the success of his login, you can track it at the top of the
after-dialog.phpfile by :Hope that helps !
EDIT: As you pointed out (in the comments of this answer) the comments in the code of the SDK say :
But the reference of the API says :
and :
I also ran some tests and the user is always redirect to
redirect_uri, even if he clicks “Don’t allow”. It must be a typo in the code comments.