How to Fix Facebook PHP SDK Error When Updating

A recent update to the Facebook SDK has caused issues with some older versions which causes the following error:

PHP Fatal error: Cannot use object of type stdClass as array in FacebookRedirectLoginHelper.php on line 191

To fix this issue, go to FacebookRedirectLoginHelper.php then find $response['access_token']

You will see this code:

if (isset($response['access_token'])) {
    return new FacebookSession($response['access_token']);

Replace it with this:

if (isset($response->access_token)) {
    return new FacebookSession($response->access_token);

Leave A Comment

Your email address will not be published. Required fields are marked *