0

We are using the belvg "Facebook Connect and Like" module on magento1 and noticed that login functionality is not working anymore. The error thrown at frontend is:

 Facebook Connect attempt failed

In the log files we can see this error.

2017-06-02T17:24:26+00:00 DEBUG (7): Access Token not found

PS. I did find the solution, so i made this post just to help others..

2 Answers 2

0

The problem that FB login has stop working is that Facebook had stop supporting API v2.2 after 25/03/2017 https://developers.facebook.com/docs/apps/changelog

The v2.3 includes a change to the format of access tokens that now is formated as JSON instead of URL encoded.

[Oauth Access Token] Format - The response format of https://www.facebook.com/v2.3/oauth/access_token returned when you exchange a code for an access_token now return valid JSON instead of being URL encoded. The new format of this response is {"access_token": {TOKEN}, "token_type":{TYPE}, "expires_in":{TIME}}. We made this update to be compliant with section 5.1 of RFC 6749.

In order to make it compatible with the new format you must edit file

app/code/community/Belvg/FacebookFree/Model/Request.php

and arround line 49 change

 if (isset($signed_request['access_token'])) {
    return $signed_request['access_token'];
 }

to

 if (isset(json_decode($token_response)->access_token)) {
     return json_decode($token_response)->access_token;
 }

Note: Keep in mind that in order for this module to work, you must rename folder BelVG to Belvg inside app/code/community

0

@karpa you can get the updated version of the module at our store.

This fix was applied on February.

$token_response = $this->getFbData($url);
$signed_request = Mage::helper('core')->jsonDecode($token_response, true);
if (isset($signed_request['access_token'])) {
    return $signed_request['access_token'];
}
1
  • Good to hear! I have downloaded the version from magento connect. So i guess it is best to upload the new version there or make a big note that the version on magento connect is obsolete. Thanks
    – karpa
    Commented Jun 14, 2017 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.