first thanks for your time. Im trying to build a Event for facebook login button, to redirect to a PHP that always insert the user in db, if already exists just update some stuff..
The problem is this following this steps
My status is loged out from facebook & site.. i use facebook login button to login, it ask for my facebook credentials, if i login, it redirect me to index.php?fbconnect=fbconnect wich is great, and im Perfectly Logged In , in facebook & in my site!!
If i logout, everything its fine ....i am just loged out from my site, not from facebook
If im connected to facebook , but not to my site, and click "login with facebook", NO redirection happends, so the user never logins, :( WHY?
I have tried this 3 different methods to redirect but all of them just work as i mention before.
This is a solution im trying to fix the issue i comment here, if i got this redirection everything would be perfect. but its a shame it only work the first time
<script>
window.fbAsyncInit = function() {
FB.init({
appId : <?=YOUR_APP_ID?>,
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
FB.Event.subscribe('auth.login', function(response) {
// ------------------------------------------------------
// This is the callback if everything is ok
window.location.href = 'http://www.page.com.mx/index.php?fbconnect=fbconnect';
});
FB.Event.subscribe('edge.create', function(response) {
window.location.href = 'http://www.page.com.mx/index.php?fbconnect=fbconnect';
});
FB.login(function(response) {window.location.href = 'http://www.page.com.mx/index.php?fbconnect=fbconnect';
//...
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>