Thank you dave for this awesome module. You have already stated that you not actively maintaining the module, I will soon join the maintainers crew.
I have successfully installed the module and got everything working until it got to the point where the module had to receive app token from facebook.
When i inputted the app id and the app secret, it returned "Unable to get an application token. Are you sure your ID and Secret are correct ".
i had to dig into the code to know where the error was generated from. fb_admin_application_edit_form_validate() function calls fb_admin_get_app_token() to return the app token but unfortunately the latter function did not return the token, so i tested it and this is what i found.
The facebook endpoint the fb_admin_get_app_token() calls return JSON string that needs to be parsed. Maybe when you were writing the module it return something different.
This is how the code is parsed which unfortunately cannot successfully return the app token.
<?php
if ($http->code == 200 && isset($http->data)) {
$parse = explode('=', $http->data);
$token = $parse[1];
return $token;
}
?>So i replaced the bolded part with
<?php
$token = drupal_json_decode($http->data);
return $token['access_token'];
?>which returns the app token successfully.
i had to register to post this. Please anybody that can patch this module should do so as i cannot do it considering that i am new to the system. i am going to edit the copy on my installed to reflect this until the patch is made.
the function is found in fb.admin.inc
Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | fb-token_parse_removal-2865813-11.patch | 1.12 KB | ladybug_3777 |
Comments
Comment #2
mmekutComment #3
ladybug_3777 commentedIGNORE
Comment #4
ladybug_3777 commentedShoot I uploaded the wrong patch file. Fixing....
Comment #5
ladybug_3777 commentedIGNORE
Comment #6
ladybug_3777 commentedComment #7
ladybug_3777 commentedIGNORE
Comment #8
ladybug_3777 commentedComment #9
ladybug_3777 commentedClearly I haven't had enough coffee. I re-checked my patch and the format was slightly different than your fix. Sigh. Hopefully comment #9 will have the correct format now. *face palm" LOL
This one SHOULD be correct and should work (I'm going to test it on my remote server next, seemed to work fine locally though)
Comment #10
ladybug_3777 commentedThe application was added now, but I'm continuing to get errors:
Notice: Undefined index: logo_url in fb_admin_application_edit_form_validate() (line 988 of /var/www/html/sites/all/modules/contrib/fb/fb.admin.inc).
Notice: Undefined index: icon_url in fb_admin_applications_form() (line 762 of /var/www/html/sites/all/modules/contrib/fb/fb.admin.inc).
Also, once I try to set up the Site-Wide default token I am getting....
Notice: Undefined index: access_token in fb_auth_get_token() (line 973 of /var/www/html/sites/all/modules/contrib/fb/fb.module).
Back to work on the fix....
Comment #11
ladybug_3777 commentedThe token issue is now fixed. New patch attached.
There are additional issues with the logo and icon messages, along with the link that goes out to the facebook post... but those issues are different from this one.
This patch should at least get the module up and running again and posting to FB.
Comment #12
mmekutThank you ladybug for the patch. i appreciate your effort.
Comment #13
ladybug_3777 commentedNo problem mmekut! We'll work together to keep this module running!
Comment #14
socialnicheguru commentedComment #15
socialnicheguru commentedthis worked for me. thank you.
Comment #16
danielvezaHappy with patch #11. Worked well for me.
Comment #17
avpaderno