Skip to content Skip to sidebar Skip to footer

Why Is My Facebook Connect Button Taking Me To The Wrong URL?

I'm trying to link my website with Facebook. If I call the method in the PHP SDK called getLoginUrl(), it returns the correct login URL. This URL contains a number of parameters, o

Solution 1:

PHP should handle only login callback if necessary, login should be done through javascript.

FB api initialization:

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
    FB.init({
        appId  : appId,
        status : true,
        cookie : true,
        xfbml  : true
    });
</script>

Then you can trigger fb login dialog on some button:

FB.login(function(response) {
    //callback
}, {perms:'publish_stream'});

Also make sure you have correct settings in your fb app under "Connect" tab - "Connect URL" and "Base Domain" should be set. If they link to a wrong domain you won't be able to login.


Post a Comment for "Why Is My Facebook Connect Button Taking Me To The Wrong URL?"