public function testSessionInfo()
 {
     $params = array('input_token' => FacebookTestHelper::$testSession->getToken());
     $response = (new FacebookRequest(new FacebookSession(FacebookTestHelper::getAppToken()), 'GET', '/debug_token', $params))->execute()->getGraphObject(GraphSessionInfo::className());
     $this->assertTrue($response instanceof GraphSessionInfo);
     $this->assertNotNull($response->getAppId());
     $this->assertTrue($response->isValid());
 }
 /**
  * Get more info about an access token.
  *
  * @param string|null $appId
  * @param string|null $appSecret
  *
  * @return GraphSessionInfo
  */
 public function getInfo($appId = null, $appSecret = null)
 {
     $params = array('input_token' => $this->accessToken);
     $request = new FacebookRequest(FacebookSession::newAppSession($appId, $appSecret), 'GET', '/debug_token', $params);
     $response = $request->execute()->getGraphObject(GraphSessionInfo::className());
     // Update the data on this token
     if ($response->getExpiresAt()) {
         $this->expiresAt = $response->getExpiresAt();
     }
     return $response;
 }
 /**
  * validateTokenInfo - Ensures the provided GraphSessionInfo object is valid,
  *   throwing an exception if not.  Ensures the appId matches,
  *   that the token is valid and has not expired.
  *
  * @param GraphSessionInfo $tokenInfo
  * @param string|null $appId Application ID to use
  *
  * @return boolean
  *
  * @throws FacebookSDKException
  */
 public static function validateSessionInfo(GraphSessionInfo $tokenInfo, $appId = null)
 {
     $targetAppId = static::_getTargetAppId($appId);
     if ($tokenInfo->getAppId() !== $targetAppId || !$tokenInfo->isValid() || $tokenInfo->getExpiresAt() !== null && $tokenInfo->getExpiresAt()->getTimestamp() < time()) {
         throw new FacebookSDKException('Session has expired, or is not valid for this app.', 601);
     }
     return true;
 }