Facebook PHP SDK login problem

Have you integrated a facebook login to your site, or are you planning to? There\'s a small bug involving the sign in process that can make your life miserable unless you know how to get around it. Here\'s one possible solution.

Why use facebook for user sign ins?

Implementing a facebook login for your site to get rid of having your own user verification may be a good idea, but it will probably not be a time saver.

Instead, you can quite possibly attract more users to actually sign in as they won\'t have to go through yet another sign up process with required fields, captchas and whatnot.

Once you\'ve read the documentation, downloaded their php sdk, set up your facebook app you will probably start implementing it and quickly have it ready for testing.

The facebook sign in bug

The problem you will most likely encounter is a bug that has been verified by facebook, and the description is:

  • You hit your facebook-login button
  • You\'re redirected to the facebook sign in page
  • You enter your credentials and accept the required permissions for your app
  • You\'re then redirected to your page where you try to read the user details

For some reason the last step won\'t work, but if you hit refresh on your page it will somehow magically work! In short, after signing in you need to refresh the page in your browser in order to get any user info out of the facebook PHP sdk.

 

One possible workaround

It\'s really simple, in the script you have set as redirect url for the facebook api, add the querystring \"?firsttime=true\". Then, before you output any data, check if the querystring \"firsttime\" is set. If it is, redirect to the same url but without the \"firsttime\" querystring.

There\'s currently no code samples for this article as I presume you are familiar with php redirects using header(\'Location: ... and that you have the sdk setup correctly.

Working example

 

 

 

 

Psst!

Besök min svenska sida om staden Hudiksvall och vad som finns där, en trevlig stad.

Hudiksvall

 

 Facebook Signin using the PHP SDK

Have you setup a facebook app and downloaded their sdk, and don\'t know where to go from there?

 Facebook PHP SDK login problem

Have you integrated a facebook login to your site, or are you planning to? There\'s a small bug involving the sign in process that can make your life miserable unless you know how to get around it. Here\'s one possible solution.

 Internet Explorer 9, JScript Error c00c023f

Ajax and Error c00c023f

After updating to Internet Explorer 9, a previously working ajax driven site of mine stopped working sporadically.

In this short article you will see how to reproduce, and how to solve the problem.

 Facebook Like button shows blank, solution

The \"EnkelAdress on Facebook\" button displayed just fine for a couple of days and then suddenly it showed up blank, no matter how many times trying to copy the code provided by Facebook. After quite some time digging deep in the information jungle we found the solution.

Page 1 / 2

 Facebook PHP SDK login problem

Have you integrated a facebook login to your site, or are you planning to? There\'s a small bug involving the sign in process that can make your life miserable unless you know how to get around it. Here\'s one possible solution.

 Thumbs Up Immerse VR Headset

This Immerse headset from ThumbsUp offers both positive and negative sides.

 Know your limits: Web Design

You might have the best app ever created, or you might have the user friendliest web page in the world. You might even have the most useful piece of shareware ever made and still not making any money.

 DroidXplorer big in China?

According to an email DroidXplorer will be preinstalled on devices, and be featured on a set of app stores. For free.

 Would this interest you?

Page 1 / 11