• 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 4 replies - 61 through 64 (of 64 total)
  • Hi reddalek are you willing to publish the changes you made to make the plugin compatible with Graph 2.8? I’m comfortable with PHP but don’t have any experience with the API.

    Andy

    Thread Starter reddalek

    (@reddalek)

    Hi Andy,

    All I did was replace every instance in the code of 2.2 with 2.8 (part of the Graph URLs), and observed that it kept working ??

    I don’t use all of the plugin’s functionality so it’s totally possible that something did break.

    Well, Google tells me that 2.4 might stop working on 9th October so I’ve little to lose. We don’t use the API much so I’ll have to wait and see if that change works for us OK.

    I’ve kept my 2.2 version (with your patch) just in case.

    Many thanks for getting back so quickly.

    Andy

    ymf

    (@ymf)

    Thank you @reddalek!

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