Support » Plugin: Add Link to Facebook » Fix for ‘Facebook error: Invalid OAuth access token’ error with API v2.3

  • 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 - 46 through 60 (of 64 total)
  • Yes, ID and secred are correct. I have copied and pasted them again but nothing has changed. I will try to reset the secret tonight unless you have better idea. Thanks.

    @loeschl Glad you are taken care of!

    @tschooper Sounds good. If that doesn’t work, perhaps message me separately and we can try to work it out. My email is mail@ and then the website listed on my profile.

    Hi guys,

    The error gone, but now the link is published on my personal profile, not the page it was set before…how can I fix this ?

    Thanks !

    Mode auto-solve : the parameter were deleted, I modified the “pages” part and it solved my problem 😉

    • This reply was modified 6 months, 1 week ago by  elmanu.

    Thank you @reddalek for the fix to this annoying problem.

    • This reply was modified 6 months, 1 week ago by  kimijye.
    Rick Leslie

    (@pcservices)

    Thanks, it worked for me 🙂

    It didn’t work for me. And after upgrade otpion for posting to pages is missing. Now I have in plugin admin panel information, that “This option is only available in Add Link to Facebook Pro”. The plugin maitainer didn’t reply form my mail sent few days ago. How can I get the Pro version?

    • This reply was modified 5 months, 4 weeks ago by  krozycki.

    @krozycki

    I am not sure the Pro version is still available I’m afraid.

    When you say it didn’t work… are you still getting the same error message? Have you tried re-authorising the plugin?

    This is, without a doubt the best Facebook integration plugin. I hate to see it has basically been abandoned, as I’m sure eventually it will no longer integrate. However, thank you very much reddalek for solving the problem I had, and helping me get the plugin working once again.

    Does anyone know of a supported plugin that does the same thing (i.e. posting the links with excerpts and text, along with the best comment integration I’ve seen)?

    krozycki

    (@krozycki)

    @reddalek: Yes. I have these messages. I re-authorised the plugin and also tried the fix in PHP file that you’ve proposed. I think I should be looking for another plugin. I’d like something, which could produce FB post like on this image:
    http://i68.tinypic.com/213g8b9.jpg

    I could attach my own image to every post (original posts don’t have pictures). Does anyone know WP FB plugin, which can do the same as Add Link to Facebook?

    Or maybe someone could share ZIP package with Pro version of this plugin?

    • This reply was modified 5 months ago by  krozycki.

    @reddalek: Thank you!!!! Worked for me! I’m hoping the developers see your fix and update the app.

    bambambiedermann

    (@bambambiedermann)

    All fixed – Thank You 🙂

    kimijye

    (@kimijye)

    There is no developer any more! The original developer sold this plug-in. When the new developer learned that the plug-in’s customer base wasn’t willing to be used as marketing bait for something else he was selling and promoting, new guy just walked away from the plug-in altogether. It is no longer updated, maintained or troubleshot.

    tornevall

    (@tornevall)

    Well, in that case I guess it’s up to ourselves if we want to maintain it. I have created a local branch in my git repo for doing this, but not yet had the time to initiate anything (except the most common problem with the token). Currently, I have a “2.4-unbreak”-version in my local workspace that maybe should be pushed out soon.

    However, I see some kind of importance here, to leave the older deprecated releases of Graph API whatsoever, since there is a risk that this plugin sooner or later really breaks…

    reddalek

    (@reddalek)

    @tornevall While that is certainly a risk, I did upgrade all of the Graph calls in my copy of the plugin to 2.8 and haven’t seen any broken functionality so far.

    I would so love to see a branch get developed. I’m not a coder but I will help in any way possible.

Viewing 15 replies - 46 through 60 (of 64 total)
  • You must be logged in to reply to this topic.