title: How to create a non-expiring Facebook page token as described in the Removal of offline_access permission doc
body: <p>I am trying to create a non-expiring page token that I can use on my site to make posts on my Facebook page.  According to scenario 5 in this document I should be able to do this:</p>
  
  <p><a href="https://developers.facebook.com/roadmap/offline-access-removal/" rel="nofollow">https://developers.facebook.com/roadmap/offline-access-removal/</a></p>
  
  <p>My problem is that when I generate the page tokens, they expire in 1 hour.</p>
  
  <p>What I am doing is using this code to display my user access token when I login.  I think this is the same token provided by graph api explorer, but I am unsure.</p>
  
  <pre><code>require '../src/facebook.php';
  
  $facebook = new Facebook(array(
    'appId'  =&gt; 'app_id',
    'secret' =&gt; 'app_secret',
  ));   
  
  $user = $facebook-&gt;getUser();
  
  if ($user) {
    try {
      $user_profile = $facebook-&gt;api('/me');
    } catch (FacebookApiException $e) {
      error_log($e);
      $user = null;
    }   
  }     
  
  if ($user) {
    $logoutUrl = $facebook-&gt;getLogoutUrl( array(
  
                  'scope'         =&gt; 'read_stream,publish_stream,publish_actions,manage_pages,email,user_checkins',
                  ));
  } else {
    $loginUrl = $facebook-&gt;getLoginUrl();
  }
  echo $loginUrl;
  
  $me = $facebook-&gt;api('/me');
  
  ?&gt;
  &lt;!doctype html&gt;
  &lt;html xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
    &lt;head&gt;
      &lt;title&gt;php-sdk&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;php-sdk&lt;/h1&gt;
  
      &lt;?php if ($user): ?&gt;
        &lt;a href="&lt;?php echo $logoutUrl; ?&gt;"&gt;Logout&lt;/a&gt;
      &lt;?php else: ?&gt;
        &lt;div&gt;
          Login using OAuth 2.0 handled by the PHP SDK:
          &lt;a href="&lt;?php echo $loginUrl; ?&gt;"&gt;Login with Facebook&lt;/a&gt;
        &lt;/div&gt;
      &lt;?php endif ?&gt;
  
      &lt;h3&gt;PHP Session&lt;/h3&gt;
      &lt;pre&gt;&lt;?php print_r($_SESSION); ?&gt;&lt;/pre&gt;
  
      &lt;?php if ($user): ?&gt;
        &lt;h3&gt;You&lt;/h3&gt;
        &lt;img src="https://graph.facebook.com/&lt;?php echo $user; ?&gt;/picture"&gt;
  
        &lt;h3&gt;Your User Object (/me)&lt;/h3&gt;
        &lt;pre&gt;&lt;?php print_r($user_profile); ?&gt;&lt;/pre&gt;
      &lt;?php else: ?&gt;
        &lt;strong&gt;&lt;em&gt;You are not Connected.&lt;/em&gt;&lt;/strong&gt;
      &lt;?php endif ?&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I then use that token in this graph api command:</p>
  
  <pre><code>https://graph.facebook.com/me/accounts?access_token=&lt;access_token&gt;
  </code></pre>
  
  <p>This gives me a list of all my pages and apps and their respective page/app tokens.</p>
  
  <p>I then take the page token I want to use and check with the Facebook Access Token Debugger and it shows it has an expiration of 1 hour.  So I use the following command to try and exchange it for a 60 day token as described in the first URL i posted:</p>
  
  <pre><code>https://graph.facebook.com/oauth/access_token?client_id=client_id&amp;client_secret=client_secret&amp;grant_type=fb_exchange_token&amp;fb_exchange_token=access_token
  </code></pre>
  
  <p>The command just gives me the error: "message": "An unknown error has occurred.","type": "OAuthException", "code": 1.</p>
  
  <p>I then thought maybe because my user access token is not long lived, it wont generate a long lived page token.  So I used my user token with the same command to extend it and it just returns the same token back with the expiration not extended.</p>
  
  <p>Can anyone offer some insight as to what I am doing wrong and how I can create this non-expiring page token?</p>