Topic-icon FYI - Facebook changes ES problem

Active Subscriptions:

None
7 years 1 month ago #61302 by stanchomer
stackideas.com/forums/there-is-an-error-...d-oauth-access-token

Hi there seems to be some changes for Facebook login and I see this info effecting EasySocial 2.0.14 and maybe that have some effect for JFBconnect too?

"..It seems that this issues is because Facebook have made some changes and it seems to mess up"

I am getting the same error:
"There is an error retrieving your Facebook details. Facebook returns an error message of: "Invalid OAuth access token.""
Fingers crossed this can be fixed quickly.

Hi!

I don't know if it could help you guys but I found this on FB dev:

++++++++++++++++++++++++++++++++++++++++=

Hello, from this morning (Rome time), the login of my web site stopped to works. It always return this error: An active access token must be used to query information about the current user.
Nothing was changed in my code nor in my facebook app.

Hey, I don't know if this would be helpful to anyone here but I'm going to write it anyway.

I also encountered this error today and after hours of digging through legacy code, I noticed that project was using old FB PHP SDK from 2011 (legacy project).

I found it on github in case you want to compare your version with this that caused me problems:

Code: github.com/facebookarchive/facebook-php-...rc/base_facebook.php

Problematic lines: #L414 and #L809 (parse_str function).

After I switched from parse_str to json_decode everything started working again.

So instead of :

$response_params = array();
parse_str($access_token_response, $response_params);

I switched to:

$response_params = json_decode($access_token_response, true);

It's working again for me.
Hope this helps!

++++++++++++++++++++++++++++++++++++++++++++++++

I added a Facebook login to my website long time ago. Everything is fine.
But from this morning, I found lots of error 500 from my server. My program stops after the line $session = $helper->getSessionFromRedirect();

Here is my code:
$helper = new FacebookRedirectLoginHelper($fb_callback_url);
try {
$session = $helper->getSessionFromRedirect(); // error 500 happens here from this morning and it cause my program stop
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
} catch( Exception $ex ) {
// When validation fails or other local issues
}

Anything wrong with getSessionFromRedirect?
Thanks

++++++++++++++++++++++++++++++++++++=

Michel

Got it!

So according to this cue I found on FB dev:

++++++++++++++++++
So instead of :

$response_params = array();
parse_str($access_token_response, $response_params);

I switched to:

$response_params = json_decode($access_token_response, true);

++++++++++++++++++++

I modified this file as mentionned :administrator/components/com_easysocial/includes/oauth/clients/facebook/base_facebook.php

and it works (at least for me)

The file is attached.

Michel
The topic has been locked.
Support Specialist
7 years 1 month ago #61304 by mel
This bug seemed to be introduced when Graph API 2.2 support was removed. It's not on the Graph API changelog, but it's something that users started experiencing immediately after that removal. The 7.2.0 release of JFBConnect from 3/28 already addresses this json_decode issue for the access tokens. If you're still having problems with this latest 7.2.0 version and are still getting the access token, please let us know.

-Melissa
The topic has been locked.