Facebook SDK login Popup

0

I have a login plugin for facebook, I got this link tutorial. so far so good, but I would like to put it to redirect to the same page where the login is requested, I've seen many sites do this with authentication popups. How can I add this popup function to redirect to the same page that was requested to login?

    
asked by anonymous 27.08.2015 / 16:42

1 answer

0

This popup you say is because they used the javascript SDK to log in with Facebook, not PHP, which is your case.

In your case you can do the following, in the method FacebookRedirectLoginHelper you pass the same URL of the login page and in it you check if the user is coming from a Facebook login as well if it is already logged in.

For example, in FacebookRedirectLoginHelper an index.php would look like:

$helper = new FacebookRedirectLoginHelper('http://seusite/index.php');
...

and right there to receive / check the user back from the Facebook login page:

if ( !empty($_GET['code']) ){
...
$helper = new FacebookRedirectLoginHelper('http://seusite/index.php');
try {
  $session = $helper->getSessionFromRedirect();
} catch
...
  • When Facebook returns from login it brings this variable GET

Ps .: Logging into Facebook using the javascript SDK is extremely productive when possible.

    
28.08.2015 / 16:08