Integration der Facebook API

Wir haben für unseren Kunden www.thanksto.com Login und Registrierung über die Facebook API (Schnittstelle) implementiert. Es war das erste Mal, dass wir mit der Facebook API gearbeitet haben, und wir haben gleich neue Maßstäbe gesetzt.

Normalerweise lässt sich die Facebook-Schnittstelle nicht im selben Browser öffnen (cross-domain security restrictions) und alle Funktionen, die man über den eigenen Code aufrufen will, müssen in einem neuen Browserfenster ausgeführt werden (einschließlich des Logins).

Wir wollten das nicht wahr haben (weil wir ungern unseren Kunden sagen “Nein, das geht nicht.”), haben Google durchstöbert und dort auch nur Kommentare gefunden, dass es nicht möglich ist und dass es in einem neuen Fenster geöffnet werden muss.

Einige schlaflose Nächte und verschiedene Lösungsansätze später, hatten wir immer noch keinen Weg gefunden und uns entschlossen, den Facebook-API-PHP-Code Zeile für Zeile unter die Lupe zu nehmen. Und schließlich haben wir doch eine Lösung gefunden! Der Facebook-Connect passiert jetzt im gleichen Fenster über einen iFrame. Wir sind damit die ersten die Facebook auf diese Weise integriert haben und dies stieß in der Entwicklergemeinde auf reges Interesse:

————————
Subject: Facebook Connect Login PHP

Hello,
I am implementing Facebook Connect for my companies website, and came across http://www.facebook.com/l/;thanksto.com. This is by far the best login box I’ve seen for the Connect stuff.
I am interested in how you managed to get the login to cleanly populate the iframe – would it be possible for you to send me the contents of fbconnect.php? I am using the Java API, and I suspect they are slightly different.
Or even an email about it would be wonderful,
My email is “xxxxxxxxx@gmail.com”.
Cheers!
Ian
————————
————————
elliott3232 from Facebook Platform Developer Forum has sent you a message.

Hi Shiv,
You got the inline/iframe facebook connect dialog to work correctly.  I checked out your site but could not figure out the magic.  If you get the time, would you be so kind as to give a little more detail?
Thank you,
David
————————
————————
muhaha from Facebook Platform Developer Forum has sent you a message.

Hey shiv,
I got kind of the same problem, writing an iphone webapp and i need something like that, otherwise everytime a user wants to connect he will get redirected to another site – thats a bit wiered when you saved the webapp on your iPhone Homescreen….
So would you mind if I´m asking for your example code??
Cheers and thanks a lot
————————
Getreu unserem Motto: “Auch wenn alle sagen, es geht nicht, probiere so lange, bist Du selbst davon überzeugt bist und gib niemals auf!”

Leave a Reply