1

I have the same problem described here: Facebook Login: How to combine JavaScript with PHP SDK?

Meanwhile (the solution for this question was proposed a year ago) the php-sdk from facebook and javascript have been updated, but i still got the same issues.

Here is my setup:

JS:

FB.init({
        appId: '<MyAppID>',
        status: true,
        cookie: true,
        xfbml: true,
        channelUrl: '<MyUrl>'
    });

PHP:

self::$facebook = new Facebook(array(
            'appId'  => self::APP_ID,
            'secret' => self::SECRET,
            'cookie' => true,
                    'sharedSession' => true //i really don't know if this has any effect
        ));
        $this->accessToken = self::$facebook->getAccessToken();
                if ($this->accessToken) {
                    self::$facebook->setExtendedAccessToken($this->accessToken);
                }
        $this->populateThis();

The function populateThis() should do the work:

$uid = self::$facebook->getUser();

            if ($uid) {
                $result = self::$facebook->api(array(
                    'method' => 'fql.query',
                    'query' => 'SELECT uid, name, email FROM user WHERE uid = me()'
                ));
                if (is_array($result) && isset($result[0])) {
                    foreach ($result[0] as $key => $value){
                        $this->$key = $value;
                    }
                    $this->isLogged = true;
                }else{
                    $this->isLogged = false;
                }

            }

but getUser() fails me too...

I must say that i have this problem only on Google Chrome right now, I've tried to do this in opera, firefox, but those reacted well.

Community
  • 1
  • 1
Decebal
  • 1,376
  • 1
  • 21
  • 36
  • And on google chrome what's the error that shows on the console? – Fabio Antunes Oct 10 '13 at 14:34
  • There are no errors in console or logged to apache , I don't see any errors logged by the sdk in my logs, either – Decebal Oct 10 '13 at 14:58
  • Most likely a problem with Chrome not accepting the cookies set by the JS SDK then – so check that. – CBroe Oct 10 '13 at 17:36
  • Which cookies do you think i should follow ? I extended my debug and found out that if the signed request was saved on a cookie then the authentication works, but somehow the problem might be bigger than this. – Decebal Oct 11 '13 at 07:31
  • I'm voting to close this question as off-topic because use of out of date API's – Decebal Jul 07 '16 at 11:16

0 Answers0