Nerede Facebook tanımlama bulmak için?

0 Cevap php

I'm kinda new to this so bear with me. I've installed a "Login with Facebook" button via the Javascript SDK, which works fine. I've also set up the PHP code (facebook.php) I can login successfully to Facebook via javascript but then can't access the UID from the session via php. So, how can I get php to access the session javascript sets? thanks

Edit: (okumak için daha kolay olacak bu yüzden burada aşağıdan Gönderme kodu)

Ben yanıtı oturum ve onu görmek konsol olabilir.

FB.getLoginStatus(function(response) {
    console.log(response.session.uid);
});

Sayfayı yenileyin ve php yoluyla kuruldu oturumu erişmeye çalıştığınızda, null ile çıkageldi.

require_once(RELATIVE_PATH.'applibs/facebook.php');
$config = array('appId'=>Config::$fb_app_id, 'secret'=>Config::$fb_secret, 'cookie'=>true);
$fb = new Facebook($config);
$fb->getUser(); // this will equal null because the $fb object isnt finding the cookie supposedly set by javascript

* facebook.php bazı hata ayıklama mi

on line 358... $cookieName = $this->getSessionCookieName();
// retuns fbs_myNumericAppId, seems like that worked..
if (isset($_COOKIE[$cookieName])) {
// FAILS! there is no $_COOKIE['fbs_myNumericAppId']

That seems logical as how could logging into facebook.com know what my app ID is?
I also noticed after logging into facebook.com, there's NOTHING facebook related in $_COOKIE. So, in order to log into facebook via facebook.com, then have a website notice that login, you have to run FB.login on a page load. Then you have to set a cookie via the javacript info returned into $_COOKIE so the php can pick it up anywhere else.

0 Cevap