Facebook Stackoverflow style login

Hello, I am trying to make a choice to log in to my site with my facebook accounts. As far as I read on facebook api, I found only a login with a popup , but I don’t like it ...
I would like to do it like here in stackoverflow 1. the user clicks the “Login” button with the ot button

2. the whole window goes to the FB page and asks perm
3. to return the user to my page ...

+5
source share
1 answer

If you use:

http://github.com/facebook/php-sdk

You can do something line by line:

    $facebook = new facebook();
    $fbSession = $facebook ->getSession();

    //IF user is logged in
    if ($fbSession)
    {
        $_SESSION['fbsession'] = json_encode($fbSession);
    }
     else
    {
        header('Location: '.$facebook->getLoginUrl());
    }
+9
source

All Articles