Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

FB PHP SDK Issue

Options
  • 19-03-2014 3:20pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    I'm trying to integrate the Facebook PHP SDK to allow users to login onto a website with their Facebook account. Below is the code I'm using, I'm logged into Facebook and the first time I go and click on the login link it pops up with the 'allow Facebook share profile information with this website' message which is grand, when I click OK it redirects back to the login page on the website still displaying the login URL.

    I did notice that there is a code parameter now in the address bar url with a long string.

    Can anyone suggest if I'm missing something or doing something wrong?!

    As always any help greatly appreciated, thanks.
    $vFacebook = new Facebook(array(
      'appId' => '....',
      'secret' => '....',
      'fileUpload' => false,
      'allowSignedRequest' => false,
    ));
    $vUID = $vFacebook->getUser();
    $vLoginURL = $vFacebook->getLoginUrl(); 
    
    if ($vUID)
    {
    	try {
    		$vFBUserProfile = $vFacebook->api('/me','GET');
    		var_dump($vFBUserProfile);
    		exit();	
    	}
    	catch (FacebookApiException $e)
    	{
    		echo 'Please <a href="' . $vLoginURL . '">login.2</a>';
    		error_log($e->getType());
    		error_log($e->getMessage());
    	}
    }
    else
    {
    	echo 'Please <a href="' . $vLoginURL . '">login.1</a>';
    }
    


Comments

Advertisement