Sto implementando il login di Facebook utilizzando l'SDK PHP con Codeigniter. Ottengo il popup di accesso a Facebook, accesso, ma non riesco a recuperare l'id dell'utente - restituisce sempre 0.Facebook getUser() restituisce 0
Ho inserito i file facebook.php e base_facebook.php nel mio file di librerie e l'ho incluso come libreria in Codeigniter che segue un tutorial here.
Qualcuno può dirmi cosa pensano stia succedendo? Sto usando il seguente codice -
View - Facebook pulsante di accesso
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $this->config->item('facebook_app_id'); ?>',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
FB.Event.subscribe('auth.login', function() {
window.location='<?php echo base_url(); ?>auth_other/fb_signin/';
});
};
(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>
<div class="fb-login-button">Login with Facebook</div>
Controller - auth_other/fb_signin
function fb_signin()
{
$fb_user = null;
$fb_config = array(
'appId' => $this->config->item('facebook_app_id'),
'secret' => $this->config->item('facebook_app_secret')
);
$this->load->library('facebook',$fb_config);
$fb_user = $this->facebook->getUser();
echo $fb_user;
non è corretta, quanto sopra funziona anche sotto localhost se si indica tela URL, "http: // localhost/my-grande-app /" e sotto domini app "localhost" È possibile che questo – dendini