Vanilla Forums – Facebook login UniqueID required issue fix

Maybe some of you has encountered issue when vanilla forums social login for Facebook keeps returning error which says that uniqueID is required. I did some digging and finally got to the roots of the problem.

Simple fix is to go to plugins/Facebook/class.facebook.plugins.php find function getAccessToken() and change following part:

if (strpos(val('content_type', $Info, ''), '/javascript') !== false) {
$Tokens = json_decode($Contents, true);
} else {
parse_str($Contents, $Tokens);
}

To

if (strpos(val('content_type', $Info, ''), '/json') !== false) {
$Tokens = json_decode($Contents, true);
} else {
parse_str($Contents, $Tokens);
}

Problem here was that curl $Info[‘content_type’] returnsĀ application/json rather than application/javascript. Therefore function does not return actual accessToken, needed to obtain facebook data of specific user profile.

I hope this saves someones day.

 

  • Aaron Webstey

    THANK YOU

    • Aidas Keburys

      No problem, glad it was helpful!