Active
Project:
Drupal for Facebook
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Feb 2009 at 17:07 UTC
Updated:
2 Dec 2010 at 04:28 UTC
Jump to comment: Most recent file
Comments
Comment #1
gemini commentedWith that particular message on the edit page, error log shows: "Failed to log into facebook app as user fbu_any". Location and referrer URL is http://www.phoenixhomes.com/node/add/fb-app
Comment #2
Dave Cohen commentedI don't think that log message is really part of the problem. The attached patch should make it go away. I don't think this patch will affect the root problem, but if you don't mind testing, I'd appreciate it. I still have not reproduced this myself.
Comment #3
gemini commentedDave,
I downloaded latest upgrade yesterday and my code doesn't even match your difference
You have an extra condition wrapping the "try{}"
Comment #4
Dave Cohen commentedI checked some changes in yesterday. That entire clause, with patch above, is:
Comment #5
gemini commentedUpdated - no error message in the logs. Now we need to figure out why there is a problem with the API key :)
Comment #6
Dave Cohen commentedI don't think the apikey is the problem. Based on a comment you made in another issue, it looked like facebook's admin_getAppProperties was in fact returning correct information. So the validation could be failing due to a bug in fb_app.module. But from looking I could not tell what the problem is.
Comment #7
butteryak commentedI get the same error. checked everything above, made changes to facebook php. my log error only states " Failed to log into facebook app as user fbu_any"......patch(on facebook php) did not seem to make any differance. tried to apply patch to fb_app.module but I get parse error.
Not sure what to do next with this, as I'm still learning, but I'm more than happy to share info, if it's helpful.
Comment #8
socialnicheguru commentedi have this problem too. however, there is nothing in my log.
Do I need to submit my app to the directory? I hope not. i am still working on it :)
I put the debug code in:
1. Called facebook.admin.getAppProperties show in php:
{"about_url":"","application_name":"testred","edit_url":"","post_install_url":"","uninstall_url":"","callback_url":"http:\/\/mysite.com","canvas_name":"testred"}
what is used to verify?
I even reset my key.
I would love to get a page up ASAP.
Comment #9
Dave Cohen commentedCan someone help me by adding
Right after the call to fb_app_get_app_properties($fb_app) in fb_app_validate(), in fb_app.module?
Then reproduce the error and post here the extra debug output (omit the secret). Since I can't reproduce the problem I'd like to see what your data is.
The fact that the facebook debug info shows values like "application_name":"testred" means that your apikey and secret are fine. The error message is misleading.
For a workaround, I suggest disabling fb_app_validate. Just rename it to fb_app_validateXXXX, temporarily. Then, manually set the canvas path, if you're using canvas pages, with something like "UPDATE fb_app SET canvas='YOUR_CANVAS_PATH' where nid=YOUR_APP_NID;" after you save the other settings.
Comment #10
gemini commentedDave,
I got a few things.
1. This is the error that was in the log:
2. This is the object output:
Comment #11
Dave Cohen commentedThe "cannot modify header" error is produced by facebook's debug output. I don't think there's anyway to avoid it, when $conf['fb_debug'] is true.
The call to fb_app_get_app_properties() is supposed to take a reference and add values to it. Can you add another
dpm($fb_app, "fb_app_get_properties returning");to the very end of fb_app_get_app_properties()?Comment #12
socialnicheguru commentedI put it in and this is what I get
fb_app_get_properties returning => stdClass Object
(
[label] => correct label
[apikey] => correct key
[secret] => correct secret
[id] => correct id
[fb_app_data] => what is this
)
label- does fb check this against something in my app?
what is fb_app_data? nothing was returned.
Comment #13
Dave Cohen commentedPlease change the dpm call to show more values. Try this:
Label gives code another way to refer to your app. This is often more convenient than a node id or apikey.
fb_app_data is a serialized blob of data about the app. Settings that dont need an index in the database. Drupal's user object has an analogous data field.
Comment #14
socialnicheguru commentedfb_app_get_app_properties values => Array
(
[fb_app] => stdClass Object
(
[label] => test_fb_app_module
[apikey] => correct apikey
[secret] => correct secret key
[id] =>
[fb_app_data] =>
)
[props] => Array
(
[about_url] =>
[application_name] => My test app
[edit_url] =>
[post_install_url] =>
[uninstall_url] =>
[callback_url] => http://mysite.com/mytestapp
[canvas_name] => mytestapp
)
[fb] => Facebook Object
(
[api_client] => FacebookRestClient Object
(
[secret] => correct secret key
[session_key] =>
[api_key] => correct api key
[friends_list] =>
[user] =>
[added] =>
[is_user] =>
[canvas_user] =>
[batch_mode] => 0
[batch_queue:private] =>
[call_as_apikey:private] =>
[use_curl_if_available:private] => 1
[last_call_id] => 1233973968.4928
[server_addr] => http://api.facebook.com/restserver.php
[cur_id] => 1
)
[api_key] => correct api key
[secret] => correct secret key
[generate_session_secret] =>
[session_expires] =>
[fb_params] => Array
(
)
[user] =>
[profile_user] =>
[canvas_user] =>
[base_domain:protected] =>
)
[cache] => Array
(
[Api Key] => Array
(
[about_url] =>
[application_name] => My test app
[edit_url] =>
[post_install_url] =>
[uninstall_url] =>
[callback_url] => http://mysite.com/mytestapp
[canvas_name] => mytestapp
)
)
)
Comment #15
Dave Cohen commentedWell, I see the problem now, but I'm still mystified.
In my facebook client, a call to admin_getAppProperties() return a PHP object. But it looks like yours returns an array. Something is really wrong. It will take some investigating to determine just why that is.
In the meantime, try adding
$props = (object) $props;right after$props = $fb->api_client->admin_getAppProperties(array_values($props_map));in fb_app_get_app_properties().Comment #16
Dave Cohen commentedI looked at the code and it seems the method should be returning an array and not an object. I have no idea why on my server its returning an object. Anyone know PHP and json_decode() well enough to tell me why?
Comment #17
Dave Cohen commentedWhat version of PHP are you guys using? I'm using 5.2.7
Comment #18
socialnicheguru commented-bash-3.1$ php -v
PHP 5.2.6 (cli) (built: May 2 2008 16:06:40)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
Comment #19
socialnicheguru commentedrecasting $props as an object does not work. I get the debug output
and a white screen
Comment #20
socialnicheguru commentedis this supposed to be this way?
function fb_app_validate_fb_app() {
//dpm(func_get_args(), 'fb_app_validate_fb_app');
}
it is used in line 175 of fb_app.module
// Now we define the form elements specific to our node type.
$form['fb_app'] = array('#tree' => TRUE,
'#weight' => -4,
'#validate' => array('fb_app_validate_fb_app' => arra\
y()),
);
I don't know if it has any relevance at all, but I thought I'd ask :)
this is (has potential) to be a kick a#s module! Looking forward to getting it completely working so I can take it through it's paces.
Comment #21
Dave Cohen commentedJust checked in the fix. props is an array, not an object
Comment #22
socialnicheguru commentedUpgraded to new version 2/8/09. The change breaks my install. I get the white screen.
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/fb/fb_app.m...
1. old install that was working
once I replaced the three lines- white screen
once I reverted back- fine (still has original error)
require once was in settings.php file as prescribed
2. clean install
installed and white screen if I put "require once in my settings file".
If i commented it out, then white screen goes away but original error is still there
Comment #23
Dave Cohen commentedI don't understand the problem you're describing, but it sounds like not the same issue.
Please use the latest version of the modules and submit a new issue describing the white screen problem. Take a look at your apache error log as it probably will have an error everytime you get a white screen.
Comment #24
socialnicheguru commentedEDIT UPDATE: THIS IS FIXED!!!!!
The items i got below no longer apply.
Add this to settings.php:
$conf['fb_api_file'] = 'sites/all/modules/fb/facebook-platform/php/facebook.php';
require_once "sites/all/modules/fb/fb_settings.inc";
Now I have a new issue actually related to the overall thread:
Now I get Failed to get application properties from Facebook: Invalid API key 101
I set debug to true in settings.php file per troubleshooting instructions:
: Called facebook.admin.getAppProperties, show Params | XML | SXML | PHP
Array
(
[properties] => ["about_url","application_name","edit_url","post_install_url","uninstall_url","callback_url","canvas_name"]
)
{"about_url":"","application_name":"activelyOUT activeEvents","edit_url":"","post_install_url":"http:\/\/localhost\/beta\/fb_cb\/10781\/fb_app\/event\/post_authorize","uninstall_url":"http:\/\/localhost\/beta\/fb_cb\/10781\/fb_app\/event\/post_remove","callback_url":"http:\/\/localhost\/beta\/fb_cb\/10781\/","canvas_name":"activelyOUTevents"}
I placed this as per #13 above
dpm(array('fb_app' => $fb_app, 'props' => $props, 'fb' => $fb, 'cache' => $cache), 'fb_app_get_app_properties values');
Nothing is filled in... Nothing is being referenced.
fb_app_get_app_properties values => Array
(
[fb_app] => stdClass Object
(
[fb_app_data] =>
)
[props] =>
[fb] => Facebook Object
(
[api_client] => FacebookRestClient Object
(
[secret] =>
[session_key] =>
[api_key] =>
[friends_list] =>
[user] =>
[added] =>
[is_user] =>
[canvas_user] =>
[batch_mode] => 0
[batch_queue:private] =>
[call_as_apikey:private] =>
[use_curl_if_available:private] => 1
[last_call_id] => 1234223574.86
[server_addr] => http://api.facebook.com/restserver.php
)
[api_key] =>
[secret] =>
[generate_session_secret] =>
[session_expires] =>
[fb_params] => Array
(
)
[user] =>
[profile_user] =>
[canvas_user] =>
[base_domain:protected] =>
)
[cache] => Array
(
[] =>
)
)
Comment #25
socialnicheguru commentedthis is a reply to #22:
Ok.. this is weird. it was a conflict with Og_vocab
PHP Fatal error: Cannot redeclare custom_url_rewrite() in sites/all/modules/og_vocab/og_vocab.module on line 16
http://drupal.org/node/275665
so i just deactivated it.
Comment #26
butteryak commentedNoted that this is listed as "fixed" I've been following along a bit, and I've updated to the revised module. But I still have the same issue. Double checked all API,secret, etc. info. still get the "Unable to get application properties. Confirm both apikey and secret." Pardon my ignorance if I've missed something obvious.
Comment #27
Dave Cohen commentedbutteryak, could be you have the same problem I originally had, described here: http://bugs.developers.facebook.com/show_bug.cgi?id=4351
If that's the case, its not obvious and you're not ignorant. Its another frustrating bug in the facebook api. Check whether your server's php has the json functions built in.
Comment #28
butteryak commentedThanks dave,
noted and appreciate the support. I was thinking this must be somthing obscure as I've been following the posts pretty closely and doing what has been done so far. I'm running this on apache2 with PHP 5.2.4 built on Ubuntu. According to my phpinfo. I have json installed and enabled. So if I'm understanding this correctly. My php installation may be returning an Array in some functions that I may want to be an Object? Or am I backwords in my thinking on that one. If so....whats the fix.
Comment #29
Dave Cohen commentedIf you have json built into your PHP, the function will return an array and everything should work as expected. Try adding the debug code in comment #13 and post what you see.
Comment #30
butteryak commentedthis is what I get. Interesting I'm getting nothing for 'props' 'fb' or 'cache'.............
#
fb_app_get_app_properties values => Array
(
[fb_app] => stdClass Object
(
[label] => correct
[apikey] => correct
[secret] => correct
[id] => correct
)
[props] =>
[fb] =>
[cache] =>
)
#
fb_app_get_properties returning => stdClass Object
(
[label] => correct
[apikey] => correct
[secret] => correct
[id] => correct
)
Comment #31
chrisbuck commentedPardon my ignorance, but could someone explain how to change the DPM call, as referenced in #'s 13 and 29? Thanks.
Comment #32
butteryak commentedCBFPLC,
Not sure if this will help you or not, check out post #9, it tells you where to put it. open up the fb_app.module and place it (the dpm) right after the fb_app_get_app_properties($fb_app) line in the fb_app_validate() section. hope that helps. next time you submit your facebook application, you should get the debug output.
butteryak
Comment #34
Dasha_V - old commentedHad the same issue.
The fix was - to enable openssl extention for php.
Comment #35
drupal3008 commentedI have read the README.txt from top to bottom!
I've searched through all instances of this issue and one of the closed threads said that facebook had fixed the issue, but it is coming up for me.
This is the output of $url for me {"error_code":"104","error_msg":"Incorrect signature","request_args":[{"key":"method","value":"admin.getAppProperties"},{"key":"properties","value":"about_url,application_name,edit_url,authorize_url,uninstall_url,canvas_name,callback_url,connect_url"},{"key":"access_token","value":""},{"key":"api_key","value":"###################"},{"key":"format","value":"json-strings"}]}
I have double checked everything from the API key, secret etc, and still get that problem with this error:
Unable to get application properties. Confirm both apikey and secret.
1) Downloaded latest PHP sdk files
2) Using latest module Beta 1
Comment #36
Ymox commentedSubscribing
I'm beginning to think that it could come from something else than Facebook or any fb.module. The latest Facebook API was released to be able to cope with some changes in the OAuth library…
(I had Facebook Connect on a website, with version 6.x-2.0-rc2, and all settings were retrieved without problem – that was last week. But I tried to get these settings once again yesterday, I got disconnected from Drupal – yes, I got the Drupal message "You can't access this page", and I had to reconnect.)
[Edit] (Shall next one to post set "active" again?)
Comment #37
drupal3008 commentedI was able to use 6.x-2-dev and make it work again, but would rather use the latest version!
Comment #38
Ymox commentedSorry, I did not want to open a new thread, I think there are enough on this already…
I uninstalled the last version I had (3.0-beta1) to install 3.0-beta3. Read scrupulously the readme for this version and applied carefully the instructions that are in.
I have latest version of Facebook PHP SDK in sites/all/libraries/facebook-php-sdk (is there a message displayed if any fb module can't find it?), and to be sure, I put the line in my settings.php.
Checked thrice. Still same problem.
Could it come from my site, which base_url is like http://www.example.com/subfolder ?
I'm desperate to find a solution, as since I upgraded to version 3, I can't create any new app – and I now can't create the first one either. As it's the only one I currently need…
Thanks in advance
Comment #39
Dave Cohen commentedHave you confirmed the apikey and secret are both correct? Didn't paste them into the wrong fields? (is that what you mean by checked thice?)
I assume you've enabled fb_devel.module, checked the logs and status report?
Have you tried the fix from #34?
Which "migrations" do you have enabled on the remote settings?
You don't need to include facebook.php from your settings.php, but it shouldn't hurt either.
Comment #40
Ymox commentedI have checked API and secret keys, entered them in corresponding fields, even tried to invert them : in this case, I receive a 101 Error (invalid API key). Also, I tried to reset the secret key.
By checked thrice, I mean that I read as many times the readme, and checked the settings said to set.
Satus report : Drupal for Facebook full green. Drupal for Facebook Devel too. Facebook PHP SDK found.
In the watchdog, nothing.
I can't see anything such as queries to Facebook as you tell I should in the first post!?
OpenSSL is activated on my server.
As to migrations, I left them by defaul, i.-e. everything disabled.
Server conf : dmu28.infomaniak.ch/phpinfo.php (I hope you can access to it without being logged)
Comment #41
Dave Cohen commentedJust guessing here... try enabling the first migration. I don't think there is any one "default" I think it depends on when you created the app. More recent apps have more migrations enabled. I think but I'm not sure.
Lately, I enable all 4 of the migrations.
Comment #42
Ymox commentedI tried enabling the JSON relative and the secure URL thing migrations : nada.
I set those parameters this morning (~10 am CET), just tried once again (~4:30 pm CET) whenever there just was problem on propagating changes. I don't think I needed to enable the two last ones, as they're made for canvas pages, and I don't use them, but I just enabled those. I shall come and edit here the result, or post if fixed.
Is there somewhere I could see some more debug messages?
Maybe I shall try and use the OAuth library instead of the Drupal module. I'll try that tomorrow.
[Edit] Enablig canvas pages migration settings did not solve the problem.
Comment #43
Dave Cohen commentedThe modules will write to the watchdog log or to the screen if they have an error. You can always try your apache error log and anywhere else that php might be configured to write it's errors.
Comment #44
Ymox commentedNothing special in the PHP log.
Is it normal that the new Facebook API has only two files in /src, as the one I had before the 7th October had some 4 files and a /jsonwrapper directory?
Comment #45
Dave Cohen commentedMy copy has these files
I suggest you step through code in a debugger or run a packet sniffer to see what's actually crossing the network.
I really don't know what's wrong.
Comment #46
Ymox commentedSorry for replying that late.
I have the same files, so that looks OK.
Another user told me it comes from the server configuration, as he experiences the same problem on the same infomaniak.ch host.. I'll be waiting for more info, and come back to give them here.
Comment #47
Dave Cohen commentedThe comments in #798460: Can't save application on drupal, particularly about the JSON quotes and escaping, might help.
Comment #48
andrewc.swanson commentedI am running PHP 5.1.6 and was running into the "Confirm API Key and Secret" error. I was able to resolve the error by removing the quotes around the JSON string returned by facebook. json_decode, at least the extension I am running for PHP 5.1, couldn't handle the enclosing quotes.
I have the latest dev building of Drupal for Facebook and the latest Facebook SDK, as well as all four migrations enabled.
Comment #49
Dave Cohen commentedThanks for sharing. I wonder if json_decode() behaves differently in php 5.2, which is what I'm using.
Anyone else with this problem, please apply that patch and let us know if that fixes it.
Comment #50
bu5hm4nn commentedThis patch also worked for me, using the 3.0-beta3 version of fb.module, on Debian 4.0 (haven't gotten around to switching yet).
Comment #51
tamerzg commentedStill have the same problem with rc1. I tried the patch in #48 but it didn't help.
This is server info: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.7a DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_jk/1.2.28 PHP/5.2.13
Strangely on my other server it works just fine. This is info from other server, hope it helps:
Apache/1.3.41 (Unix) mod_gzip/1.3.26.1a mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.31 OpenSSL/0.9.8e-fips-rhel5 PHP-CGI/0.5
Comment #52
tamerzg commentedI traced the problem to wrongly installed Open SSL. Recompiling it solved the problem.
Comment #53
Ymox commentedHello everyone,
Replying late due to start of term and end of traineeship, I could apply the patch only today, and it works. I could set the parameters, and get the others from FaceBook without problems.
I set this as fixed, as I was the one who opened this thread again, and unless I'm mistaken, there's no longer an unsolved issue there. If there is, I hope Dave Cohen won't kill you if you set this active.
Comment #54
Dave Cohen commentedI'll set it back to active, because I don't plan to apply that patch. At least not without knowing some installs need it, while most work fine without it.
Also, its good to have this in the queue so others who have the same problem can find it.
Comment #55
Dave Cohen commentedI've made the error message more verbose. Also made the form more tolerant, so it will save the data even when this error is encountered (and even when the apikey or secret are wrong).
If you're experiencing this, please update to dev release and report back here what the more verbose error is.