Facebook login window appears and disappears very quickly

facebook, facebook-login, javascript, php

Solution

My actual error was that $facebook->getUser() returned 0 because the app wasn't authenticated and the app wasn't authenticated because I moved my code from a host to another in a different domain and I forgot changing the application configuration in http://developers.facebook.com.

Now, the app gets the login automatically. Thanks everybody!

Problem

Recently I've uploaded a piece of code to phpfog and I've come across with a problem which didn't happen locally: When the page loads, it tries to get $idFacebook that is supposed to be set: ``` $idFacebook = $facebook->getUser(); if ($idFacebook) { ... } ``` I'm logged to Facebook, however, the condition fails and the button to login appears: ``` <div class="fb-login-button" data-scope="user_likes,user_photos"></div> ``` The other problem is that when I press the button, it seems that the login window appears but it closes automatically very quickly. My code is basically the same that Heroku provides when you create a Facebook app. The repository is this one: https://github.com/heroku/facebook-template-php. I can't find how to solve it and I've seen that lots of people have experienced several problems with facebook login. I'm looking forward you can help me. Thanks in advance.

Original source

Related problems