title: how to refresh facebook access token for server side (in facebook-php SDK)?
body: <p>I'm using the Facebook PHP SDK to call relevant APIs to post and get data. At present I'm saving a user access token in the database but it expires after 60 days. How can I refresh a user access token? </p>
  
  <p>1 . When do I need to refresh the access tokens? After it expires, or before?</p>
  
  <p>2 . What is the best way to refresh access tokens?</p>
  
  <p>3 . Should my users need to login again to refresh access token? </p>
  
  <p>This is the function that I'm using to extend the access token. but expire time remain same.</p>
  
  <pre class="lang-php prettyprint-override"><code>public function getExtendedAccessToken($access_token)
      {       
  
          $token_url="https://graph.facebook.com/oauth/access_token";
          $params=array('client_id'=&gt;self :: appId,'client_secret'=&gt;self :: appSecretId,'grant_type'=&gt;'fb_exchange_token','fb_exchange_token'=&gt;$access_token);
  
            $response = $this-&gt;curl($token_url,$params);                  
            $response = explode ('=',$response);
            $response = explode ('&amp;',$response[1]);
            $response = $response[0];       
            return $response;
  
      }
  </code></pre>