Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Steps:</p> <ol> <li><p><strong>Request For manage_pages permission ( Allow this process ) :</strong></p> <pre><code>https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&amp;redirect_uri=YOUR_URL&amp;scope=manage_pages&amp;response_type=token </code></pre></li> <li><p><strong>Get Access token from URL :</strong><br> If the administrator allows this permission. You should be redirected to URL below: </p> <pre><code>http://YOUR_URL/#access_token=AAABY5jBXQz0BAEzNKkb6FZC22D7aOoKIfFuozIjoOpkGHRJ6SyzBvqx24JGooMc31374EdRFNXkOyLZCBzETRD9vhZAZC8MZD&amp;expires_in=0 </code></pre> <p>Use <strong>Access token</strong> in the URL and you should get this: </p> <pre><code>AAABY5jBXQz0BAEzNKkb6FZC22D7aOoKIfFuozIjoOpkGHRJ6SyzBvqx24JGooMc31374EdRFNXkOyLZCBzETRD9vhZAZC8MZD </code></pre></li> <li><p><strong>Check Access token using Graph API:</strong> </p> <pre><code>https://graph.facebook.com/me/accounts?access_token=TOKEN_FROM_ABOVE </code></pre> <p>Connection will return information and access token for each page.</p></li> <li><p><strong>Implement it in your code:</strong><br> You can use App access token while call a Facebook Graph API method.</p></li> </ol> <p><strong>Update:</strong><br> If you want use API method in Facebook SDK, <em>DEPRECATED</em> REST API or FQL Query...</p> <p>You have to use <strong><code>users_accesstoken</code></strong> this way:</p> <ol> <li><p><strong>Method 1:</strong><br> Use your account or users to login to your Facebook page with offline_access permissions and grab access_token while login success using <code>$facebook-&gt;getAccessToken()</code>, and save it in database so you can use it anytime.<br> You can check the expiration time of the token <a href="https://developers.facebook.com/tools/access_token/" rel="nofollow">here</a>, token with <code>offline_access</code> permissions never expire except when the user changes his password or maybe anything else.</p></li> <li><p><strong>Method 2:</strong><br> You can update your <code>access_token</code> dynamically using the code below (say goodbye to expire token). Facebook shows this solution <a href="https://developers.facebook.com/docs/reference/fql/" rel="nofollow">here</a>, it's a sample code for executing an FQL Query:</p></li> </ol> <p><strong>Code:</strong></p> <pre><code>&lt;?php $app_id = 'YOUR_APP_ID'; $app_secret = 'YOUR_APP_SECRET'; $my_url = 'POST_AUTH_URL'; $code = $_REQUEST["code"]; //auth user if(empty($code)) { $dialog_url = 'https://www.facebook.com/dialog/oauth?client_id=' . $app_id . '&amp;redirect_uri=' . urlencode($my_url) ; echo("&lt;script&gt;top.location.href='" . $dialog_url . "'&lt;/script&gt;"); } //get user access_token $token_url = 'https://graph.facebook.com/oauth/access_token?client_id=' . $app_id . '&amp;redirect_uri=' . urlencode($my_url) . '&amp;client_secret=' . $app_secret . '&amp;code=' . $code; $access_token = file_get_contents($token_url); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload