title: An active access token must be used to query information about the current user & OAuthException [code] => 2500
body: <p>When user access token , I am <em>getting error</em> like . 
  Please help me immediately. How can I solve this,tell me</p>
  
  <blockquote>
    <p>stdClass Object ( [error] => stdClass Object ( [message] => An active
    access token must be used to query information about the current user.
    [type] => OAuthException [code] => 2500 ) )</p>
  </blockquote>
  
  <pre><code>require 'facebook-php-sdk-v4/src/Facebook/autoload.php';
  require("facebook.php");
  
  $fb = new Facebook\Facebook([
    'app_id' =&gt; '1501716620042981',
    'app_secret' =&gt; '510d15193610ca682b7f79c156992bb5',
    'default_graph_version' =&gt; 'v2.3',
    ]);
  $helper = $fb-&gt;getRedirectLoginHelper();
  
  
  try {
    $accessToken = $helper-&gt;getAccessToken();
  } catch(Facebook\Exceptions\FacebookResponseException $e) {
    // When Graph returns an error
    echo 'Graph returned an error: ' . $e-&gt;getMessage();
    exit;
  } catch(Facebook\Exceptions\FacebookSDKException $e) {
    // When validation fails or other local issues
    echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
    exit;
  }
  
  if (isset($accessToken)) {
    // Logged in!
   echo $_SESSION['facebook_access_token'] = (string) $accessToken;
  
    // Now you can redirect to another page and use the
    // access token from $_SESSION['facebook_access_token']
  } 
  
  
  
       $curl_handle=curl_init();
      curl_setopt($curl_handle, CURLOPT_URL,'https://graph.facebook.com/me/?fields=albums.fields(id,name,cover_photo,photos.fields(name,picture,source)),videos.type(uploaded)&amp;'.$_SESSION['facebook_access_token']);
      curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
      curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($curl_handle, CURLOPT_USERAGENT, 'fb');
      curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
      # Return response instead of printing.
      $query = curl_exec($curl_handle);
      curl_close($curl_handle);
  
  
      print_r(json_decode($query));
  </code></pre>