Y
Y
Yuri Popov2012-04-14 02:56:03
PHP
Yuri Popov, 2012-04-14 02:56:03

Check JS session on server?

The question is simple, but Google did not cope.
There is a JS Api function: FB.login(callback...);
Callback receives info like:

response = {<br/>
authResponse = {<br/>
accessToken = &quot;...много_букв...&quot;,<br/>
expiresIn = 4734,<br/>
signedRequest = &quot;...много_букв...&quot;<br/>
userID = &quot;100001415486037&quot;<br/>
}, <br/>
status = &quot;connected&quot;<br/>
}

Who knows where to dig so that this data can be checked in PHP? At VKontakte, this was a tricky, but easy-to-understand hash (md5). There is no hint of such a thing here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2012-04-14
@DjPhoeniX

Facebook has its own API for php.
Work with it like this:

require_once 'facebook.php';
$facebook = new Facebook(array(/* здесь конфиги для FB */));
$user = $facebook->getUser();

if ($user) {
      try {
          $userProfile = $facebook->api('/me');
          // ... что-то еще
      } catch (FacebookApiException $e) {
           // как-то обработать ошибку от FB
      }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question