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.

4

0 回答 0