• Hi,

    Today Facebook ended support for v2.2 of the API, and v2.3 includes a change to the format of access tokens which broke the ‘Add Link to Facebook’ plugin and generates the access token error above.

    After a little debugging, I found a fix by editing the add-link-to-facebook-int.php file:

    Replace

    static function Process_fb_token($response) {
    	$key = 'access_token=';
     	$access_token = substr($response, strpos($response, $key) + strlen($key));
    	$access_token = explode('&', $access_token);
    	$access_token = $access_token[0];
    	return $access_token;
    }
    

    with

    static function Process_fb_token($response) {
    	$key = 'access_token=';
    	$access_token = json_decode($response)->access_token;
    //	$access_token = substr($response, strpos($response, $key) + strlen($key));
    //	$access_token = explode('&', $access_token);
    //	$access_token = $access_token[0];
    	return $access_token;
    }
    
Viewing 15 replies - 31 through 45 (of 64 total)
  • Worked for me, thank you very much!!

    @reddalek you rock! A huge thank you!

    I had some problems authorizing Facebook. It was due to iThemes Security that blocks long URLs. To solve it, I just deactivated the long URLs option in iThemes Security, and it unlocks the Facebook authorization.

    Thanks for this patch that works well. The author should update the plugin according to your patch.

    Cool … I changed one site to a different plugin yesterday due to these permanent error message(s) and now I saw the fix here.

    But honestly I’m not sure if I’ll return to this plugin. In the past this was really highly maintained, and now there’s no update for more than a year. Seems Marcel has no time anymore for his plugin, which I really liked. In my opinion it’s still a question of time until the next issue appears after a FB change … this bug should have been addressed before hundreds of sites run into the error.

    Just my 2 cents ??

    Thread Starter reddalek

    (@reddalek)

    @netmax Out of interest, which plugin did you switch to? I searched around but I couldn’t find anything with the same functionality I use (two-way comment syncing and imports of Facebook likes).

    I updated my copy of the plugin to call the latest version of the Facebook API (2.8) which was introduced on 5th October 2016 and should be supported for at least another two years.

    My understanding is that the plugin was sold.

    @reddalek I’ve switched to AccessPress Facebook Auto Post. But I can’t reimport comments … I did not find any plugin which does that.

    If the plugin was sold then it seems the new owner has no time/interest. Interesting why someone gives money for something he won’t take care of … ?!?

    TechPress

    (@destination-koh-kood)

    Thank you for the fix!

    I did everything to fix this problem but didn’t succeed, I also created a new facebook account for 3rd page and regenerate the App Id still Having error Like:

    Facebook error: Unsupported get request. Object with ID ‘musclesandwellness’ does not exist, cannot be loaded due to missing permissions, or does not support this operation.

    • This reply was modified 7 years, 11 months ago by sejalbatham.
    Thread Starter reddalek

    (@reddalek)

    @sejalbatham

    This looks like it may be a different issue. When did it start happening? Did you make the edit to the add-link-to-facebook-int.php file?

    Works Great! Thank you so much!!! ??

    I don’t have this settings “static function Process_fb_token” and so on in my add-link-to-facebook.
    so i can’t change it.

    Thread Starter reddalek

    (@reddalek)

    @loeschl

    This isn’t a setting, you will actually have to edit the source code for the plugin.

    1. Go to Plugins -> Editor on the WordPress menu
    2. In the top-right selector, select ‘Add Link to Facebook’
    3. You’ll see a list of files on the right-hand side. Select ‘add-link-to-facebook/add-link-to-facebook-int.php’
    4. Search for ‘static function Process_fb_token’ in the text editor
    5. When you find it, replace the section with the code I provided

    Then reauthorise the plugin and you should be going again.

    I have done all as described. I have replaced the section. Cleared all errors in Misc. and used Authorize button. All errors gone… but still fix does not work. In ‘Post’ it says ‘Not logged in with Facebook (anymore)’.
    BTW Under Authorization it says plugin is authorized and “links will be added to [my website name]” but when I click it, it will redirect me to this https://www.facebook.com/home.php?sk=group_1677706495848361
    Silly question… by reautarise you mean use Authorise button again??

    Thread Starter reddalek

    (@reddalek)

    @tschooper

    Yes, I do mean the Authorise button again ??

    Do you have your App ID and App Secret filled in correctly?

    @reddalek yes. I did find it at evening under “add-link-to-facebook/add-link-to-facebook-int.php”, but had no time to write it here.

    thank you. it works well again ??

Viewing 15 replies - 31 through 45 (of 64 total)
  • The topic ‘Fix for ‘Facebook error: Invalid OAuth access token’ error with API v2.3’ is closed to new replies.