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

 

 Adding a facebook like-button for Geeklog

If you have more than one web site and need to attract visitors between your sites this is a good way to do it. If you want an example of what it does, check the button in the lower left corner of your browser. Basically it's a button that will popup a list of sites, in this case it points to different projects and sites related to EnkelAdress.

 Facebook Like-button for Geeklog

The reason for this is simply put: exposure. Your site link will be exposed to everyone who is friends with a person who have "liked" your page. This is a free, simple and fast way of marketing your site. This guide will focus on how to implement the button in GeekLog with the professional theme applied.

Page 2 / 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