Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7772387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:52:44+00:00 2026-06-01T16:52:44+00:00

Facebook has removed the offline_access token functionality, now tokens have to be renewed whenever

  • 0

Facebook has removed the offline_access token functionality, now tokens have to be renewed whenever the user visits your website to keep them active.

Say someone has already given your website access and you have a token stored for them. What code would you use with Facebook’s PHP library to renew that token?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:52:45+00:00Added an answer on June 1, 2026 at 4:52 pm

    You can extend your token the following way:

    Original scenario

    • Your app requests permissions from the user
    • You prompt user to log in / grant permissions
    • You get user’s token (short-lived one) and exchange via CURL or other means for a 60 day one using grant_type=fb_exchange_token
    • You persist the token

    Now you have that token to do what you wish with it for up to 60 days. Up to, because user can change password, de-authorize app, etc and token would become invalid. What you can do to extend the token is EVERY TIME user comes to your page(s), you can check if they are logged in via javascript and if they are, make an ajax call to your server to extend existing token for 60 days from today. You can make as many calls as you want, only the first one is valid. Here’s how I do it:

    1. On your page somewhere during load event, add something like:

       FB.getLoginStatus(function (response) {
           if (response.status === 'connected') {
              $.ajax({
                  type: "POST",
                  async: false,
                  url: YOUR_URL,
                  dataType: "text",
                  data: {token  : response.authResponse.accessToken }
               });
           }
       });
               //rest of jquery ajax call here
      

    That will get a new client-side access token for the user and send it to the server

    1. Server can then take that token and exchange it for a 60 day one

      $token_url = "https://graph.facebook.com/oauth/access_token?client_id=".FACEBOOK_CLIENT_ID."&client_secret=".FACEBOOK_SECRET."&grant_type=fb_exchange_token&fb_exchange_token=".$token;
      
      $c = curl_init();
      curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($c, CURLOPT_URL, $token_url);
      $contents = curl_exec($c);
      $err  = curl_getinfo($c,CURLINFO_HTTP_CODE);
      curl_close($c);
      
      $paramsfb = null;
      parse_str($contents, $paramsfb);        
      

    Reference:

    https://developers.facebook.com/roadmap/offline-access-removal/

    That would only extend the token if the user comes back to your site within 60 days. If not, you will need to prompt for permissions again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for some Rails/Facebook functionality that has already been built - as a
I have written a Userscript for Facebook and it groups similar notifications together. Now,
So it looks like Facebook has removed the page referencing how to resize iframe
I have a list of facebook user id numbers from an xml response and
In DotNetNuke, the blog posts have a control that has icons for facebook, google,
The Python SDK seems to have been removed from Github. https://github.com/facebook/python-sdk returns a 404.
facebook has the facebook credit and I knew that they are testing on pay
Facebook has linked accounts, where facebook logs you into facebook everytime you are logged
I'm wonder how the custom scrollbar on Facebook has been made. Is it only
UPDATE: Facebook's API has changed a lot since this question was posted. This question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.