Facebook OAuth Issue
-
Hey guys, I ran into an issue and thought I’d let you guys know how i managed my way around it.
Issue:
When testing this plugin for a client project I tried OAuth via Facebook it didn’t work and always gave me ?Sorry, we couldn’t log you in. Malformed access token result detected. Please notify the admin or try again later.“Solution:
It seems that Facebook changed the way they pass back the access-token and expires-in values, and the code in the plugin is wrong.So I fixed it. In the plugin-files open login-facebook.php and between line 120 //parse the result: and line 125 //handle the result change the code to
$result_json = json_decode($result, true); // Take the JSON String responded by Facebook and decode it to an object
$access_token = $result_json[‘access_token’]; // PROVIDER SPECIFIC: this is how Facebook returns the access token KEEP THIS PROTECTED!
$expires_in = $result_json[‘expires_in’]; // PROVIDER SPECIFIC: this is how Facebook returns the access token’s expiration
$expires_at = time() + $expires_in;Now everything should work just fine, at least it did for me ??
Hope this helps!Best,
Tom
- The topic ‘Facebook OAuth Issue’ is closed to new replies.