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

  • Home
  • SEARCH
  • 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 7181715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:36:56+00:00 2026-05-28T17:36:56+00:00

Since the offline_access Permission is deprecated in Facebook’s Authentication flow, we have problem getting

  • 0

Since the offline_access Permission is deprecated in Facebook’s Authentication flow, we have problem getting the so called long lived access tokens without that permission.

In Facebook’s document about the deprecation it says, that server side OAuth generated access tokens will be long lived, but they are not.

Am I missing something? Some setting in app settings? Some special code I need to use to extend expiration time of access tokens? As I understand the documentation, for server side authentication, the access token which can be accessed by getAccessToken() method of PHP SDK when the user is logged in is long lived.

  • 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-05-28T17:36:57+00:00Added an answer on May 28, 2026 at 5:36 pm

    Edit (August 14th 2012):
    A week ago the official Facebook PHP SDK was updated. The function name was changed to setExtendedAccessToken, and it was decided we actually needed to destroy the session afterwards, to remove the risk of having two active sessions.
    Also, the function no longer actually returns the token, but instead stores it within the persistant data. You can therefore get the new access token with the public function getAccessToken afterwards. Grab the new SDK from official Facebook PHP SDK github page to make sure you’re up to date.

    Original Answer:

    I have added a new public function to the base_facebook.php file, which returns an new access token which expires in 60 days. You can make a request to this function after you’ve received the normal access token. I’ve not tested, but I assume you also need to enable ‘deprecate offline_access” in your Advanced settings of the Developer App.

    Just add this to your base_facebook.php inside the facebook class and make a call to it. It works for me.

     public function getExtendedAccessToken(){
    
        try {
            // need to circumvent json_decode by calling _oauthRequest
              // directly, since response isn't JSON format.
            $access_token_response =
                $this->_oauthRequest(
                    $this->getUrl('graph', '/oauth/access_token'), array(
                        'client_id' => $this->getAppId(),
                        'client_secret' => $this->getAppSecret(),
                        'grant_type'=>'fb_exchange_token',
                        'fb_exchange_token'=>$this->getAccessToken()
                    )
                );
        } catch (FacebookApiException $e) {
          // most likely that user very recently revoked authorization.
          // In any event, we don't have an access token, so say so.
          return false;
        }
    
        if (empty($access_token_response)) {
          return false;
        }
    
        $response_params = array();
        parse_str($access_token_response, $response_params);
        if (!isset($response_params['access_token'])) {
          return false;
        }
    
        return $response_params['access_token'];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which uses offline_access to get permanent access to different pages.
I have recently started getting this error while posting to facebook newsfeed stream of
I am struggling with this problem since last one week. I have obfuscated exe
Since CS3 doesn't have a web service component, as previous versions had, is there
So I have cloned a project at github and fixed a patch. Since this
i have been playing around with apache SOLR since last 3 weeks and very
I'm trying to set up offline access for my Facebook App. The javascript part
I am developing an application which posts videos to Facebook. I have registered this
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
Since both a Table Scan and a Clustered Index Scan essentially scan all records

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.