I am using DFF for the FB connect features. All was working great as expected. I have only 1 app that is primary app.

I had to change the Facebook's App's name in Facebook and things broke apart.

DFF asked me to Edit the primary App to resync. When I clicked on Edit, there was White Screen giving ugly errors thrown up from Facebook SDK (I believe).

Sicne there is no other way to delete app without accessing EDIT,
I accessed the data tables and deleted the entry for the primary app in FB_app.

Now DFF has no App configured. But, when I try to create new App, I get the following:

Facebook API exception Invalid OAuth 2.0 Access Token.
#0 /home/live905/domains/live905base.com/public_html/sites/all/libraries/facebook-php-sdk/src/facebook.php(490): Facebook->_restserver(Array)
#1 /home/live905/domains/live905base.com/public_html/sites/all/modules/contrib/fb/fb.module(548): Facebook->api(Array)
#2 /home/live905/domains/live905base.com/public_html/sites/all/modules/contrib/fb/contrib/fb_permission.module(186): fb_fql_query(Object(Facebook), 'SELECT permissi...')
#3 [internal function]: fb_permission_form_alter(Array, Array, 'fb_app_edit_for...')
#4 /home/live905/domains/live905base.com/public_html/includes/common.inc(2892): call_user_func_array('fb_permission_f...', Array)
#5 /home/live905/domains/live905base.com/public_html/includes/form.inc(552): drupal_alter('form', Array, 'fb_app_edit_for...')
#6 /home/live905/domains/live905base.com/public_html/includes/form.inc(107): drupal_prepare_form('fb_app_edit_for...', Array, Array)
#7 [internal function]: drupal_get_form('fb_app_edit_for...')
#8 /home/live905/domains/live905base.com/public_html/includes/menu.inc(348): call_user_func_array('drupal_get_form', Array)
#9 /home/live905/domains/live905base.com/public_html/index.php(18): menu_execute_active_handler()
#10 {main}
$_REQUEST:
Array
(
    [q] => admin/build/fb/fb_app_create
    [has_js] => 1
    [SESS3b8a2769af07ca197dcafb39f10e5b8e] => qi5smsedfabsj2h4qp8thmust3
    [__utmb] => 227624965.1.10.1296411428
    [__utmc] => 227624965
    [__utma] => 227624965.1653004657.1296249136.1296407915.1296411428.9
    [SESS1eb3185a7b73d89ab2eb98621adc644b] => m3obg67hs0krop2cqu769busr4
    [__utmz] => 227624965.1296249136.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
)


REQUEST_URI:
/admin/build/fb/fb_app_create

It seems like DFF has stored some Oauth token in cache and using old token. Is there a way to clear all the cache variables and session variables of DFF?

I upgraded from DFF 3.0 rc7 to DF 3.0 dev of today. But still the problem persists.

Any ideas?

Comments

rkarajgi’s picture

I disabled all fb modules and then uninstalled them. This removed all the tables and the data. Then enabled the modules again.

It is working properly now.

It will be great if there is a switch to just clear the stored session data of primary app - because uninstalling the module on a running live site may not be an option (all FB users will get wiped out).

Thanks

rezvani63’s picture

I think this problem refers to fb_permission.module. from your code above I see this line:

#2 /home/live905/domains/live905base.com/public_html/sites/all/modules/contrib/fb/contrib/fb_permission.module(186): fb_fql_query(Object(Facebook), 'SELECT permissi...')

I don't know this is module problem or Facebook problem. Facebook may have changed something in their API or ...!!!
I have the same problem, check it out here: http://drupal.org/node/1045074

Dave Cohen’s picture

Status: Active » Fixed

Just checked in a fix to the D6 branch.

Dave Cohen’s picture

Title: Create App fails » Facebook API exception on create app page
Version: 6.x-3.0-rc7 » 7.x-3.x-dev
Component: Facebook Connect » Code
Assigned: Unassigned » Dave Cohen
Status: Fixed » Patch (to be ported)

Fix needs to be ported to D7 branch.

rezvani63’s picture

@Dave what about D6? It's still rc7 dated Jan-07. Is it safe to use development version for production site?

triskele’s picture

Dave, can you post a copy of the patch? While the D7 port is pending I'd like to try and solve this problem as soon as I can.

Thanks,

- Angelina

ball.in.th’s picture

I just ran into "Invalid OAuth 2.0 Access Token" error on Add App page (/admin/build/fb/fb_app_create) on a fresh install of 6.x-3.0-rc7. Upgrading to 6.x-3.x-dev fixed the problem.

oddencreative’s picture

I am getting this on the dev and rc7:

Facebook API exception Invalid OAuth 2.0 Access Token.

#0 /mnt/monkeyco.de/sites/all/libraries/facebook-php-sdk/src/facebook.php(490): Facebook->_restserver(Array)
#1 /mnt/monkeyco.de/sites/all/modules/fb/fb.module(546): Facebook->api(Array)
#2 /mnt/monkeyco.de/sites/all/modules/fb/contrib/fb_permission.module(186): fb_fql_query(Object(Facebook), 'SELECT permissi...')
#3 [internal function]: fb_permission_form_alter(Array, Array, 'fb_app_edit_for...')
#4 /mnt/monkeyco.de/includes/common.inc(2892): call_user_func_array('fb_permission_f...', Array)
#5 /mnt/monkeyco.de/includes/form.inc(552): drupal_alter('form', Array, 'fb_app_edit_for...')
#6 /mnt/monkeyco.de/includes/form.inc(107): drupal_prepare_form('fb_app_edit_for...', Array, Array)
#7 [internal function]: drupal_get_form('fb_app_edit_for...')
#8 /mnt/monkeyco.de/includes/menu.inc(348): call_user_func_array('drupal_get_form', Array)
#9 /mnt/monkeyco.de/index.php(18): menu_execute_active_handler()
#10 {main}

$_REQUEST:
Array
(
[q] => admin/build/fb/fb_app_create
[SESSff940d8dedd417ac33575a705a7362f0] => kmo6m1cof82vi4actlmr1bmei4
[__utma] => 59667761.287664147.1296104108.1296630782.1296632719.17
[__utmz] => 59667761.1296104108.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
[__utmc] => 59667761
[has_js] => 1
[__utmb] => 59667761.1.10.1296632719
)

REQUEST_URI:
/admin/build/fb/fb_app_create

Dave Cohen’s picture

Status: Patch (to be ported) » Fixed
StatusFileSize
new4.84 KB

Here's the patch, just checked into 7.x-3.x branch. You won't need to apply the patch once d.o builds a new release.

drupalsam’s picture

Version: 7.x-3.x-dev » 6.x-3.0-rc7
Status: Fixed » Needs review

HI Dave,
Applied the patch, once in enable extended Permission I get the same.
"Failed to get extended permissions. Invalid OAuth 2.0 Access Token" this time its show in a warning message and don't get the fields below the Facebook Extended Permission

Dave Cohen’s picture

You should get the extended perms when you edit the settings, after you've added the apikey and secret. I don't know how to make it any easier.

ball.in.th’s picture

I am unable to get extended perms either. I've filled in App ID, API key, secret already. I got "Failed to get extended permissions. Invalid OAuth 2.0 Access Token" on the app edit page on 6.x-3.x-dev.

Dave Cohen’s picture

StatusFileSize
new955 bytes

Here's a patch for that.

ball.in.th’s picture

With patch in #13, extended perms now shows up on the app edit page and message "Failed to get extended permissions. Invalid OAuth 2.0 Access Token" is gone. Thanks a lot.

joshuabud’s picture

Great work yet again Dave! Thanks for all your hard work.

nienaber’s picture

The patch in #13 is this for 6.x-3.0-rc7?
It did not work for me. I keep getting:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: invalid permissions: !perms

I can also not edit any of the permissions.
They do not show up.

triskele’s picture

I'm still getting the OAuth issue even after the patch in #13. What information is most useful for me to give you?

clkeenan’s picture

I am receiving the same "Failed to get extended permissions. Invalid OAuth 2.0 Access Token" error. I have all my keys entered as well. I'd be happy to provide any details. What would be most useful? Running on Dev 3.x (downloaded yesterday night).

c4antonio’s picture

Subscribed

Adriano72’s picture

Subscribed

YK85’s picture

subscribing

l33tdawg’s picture

The patch in #13 works without a hitch in 7.x-3.x-dev

bcobin’s picture

I have the same error message in rc10. Here's the story so far:

(I am logged in as superadmin in FF and am using Safari to test as the client.)

I had originally been able to connect with FB while I had the OAuth 3.x branch installed (OAuth is required to post to Twitter) - I only later learned that the OAuth 3.x branch is not yet compatible with Twitter. I then had to install OAuth 2.02 to get Post to Twitter working correctly.

After that, I was unable to connect successfully to FB. I ended up uninstalling DFF, deleting the FB app, and creating a new one. I then logged in in via FB connect, and the FB app asked for permissions. (Hooray!) When I logged into Drupal, though, I was redirected to an Access Denied page.

Going to My Account, the FB account was linked (Hooray again!), but I get a "Failed to get Facebook user info for account 0123456789: Invalid OAuth 2.0 Access Token 190" message. Clicking on the full application name in My Account generates the error below.

I hope I'm posting this in the right place; it seems most applicable to the original topic, although it seems there was some diversion to the "extended apps" issue in the thread.

Could there be some old OAuth data on FB that's conflicting with the new app? Is there any way to "start fresh" here without deleting the user? I think I'm almost there - any guidance would be greatly appreciated!

And, of course, kudos to Dave for all the great work he's doing here. Thanks much!

Error message:

Facebook API exception Invalid OAuth 2.0 Access Token.
#0 /home/[site]/public_html/sites/all/libraries/facebook-php-sdk/src/facebook.php(506): Facebook->_restserver(Array)
#1 /home/[site]/public_html/sites/all/modules/fb/fb.module(574): Facebook->api(Array)
#2 /home/[site]/public_html/sites/all/modules/fb/contrib/fb_permission.module(29): fb_fql_query(Object(Facebook), 'SELECT permissi...')
#3 /home/[site]/public_html/sites/all/modules/fb/contrib/fb_permission.module(83): fb_permission_map(Object(Facebook))
#4 /home/[site]/public_html/modules/user/user.module(2524): fb_permission_user('form', Array, Object(stdClass), '[application]')
#5 /home/[site]/public_html/modules/user/user.pages.inc(254): _user_forms(Array, Object(stdClass), '[application]')
#6 [internal function]: user_profile_form(Array, Object(stdClass), '[application]')
#7 /home/[site]/public_html/includes/form.inc(378): call_user_func_array('user_profile_fo...', Array)
#8 [internal function]: drupal_retrieve_form('user_profile_fo...', Array, Object(stdClass), '[application]')
#9 /home/[site]/public_html/includes/form.inc(104): call_user_func_array('drupal_retrieve...', Array)
#10 /home/[site]/public_html/sites/all/modules/realname/realname.module(281): drupal_get_form('user_profile_fo...', Object(stdClass), '[application]')
#11 [internal function]: realname_user_edit(Object(stdClass), '[application]')
#12 /home/[site]/public_html/includes/menu.inc(348): call_user_func_array('realname_user_e...', Array)
#13 /home/[site]/public_html/index.php(18): menu_execute_active_handler()
#14 {main}
$_REQUEST:
Array
(
    [q] => user/5/edit/[application]
    [__utmc] => 252915730
    [has_js] => 1
    [authcache] => 047f78
    [drupal_user] => User Name
    [drupal_uid] => 5
    [DRUPAL_UID] => 1
    [fbs_e2fe58bbeb1c47318582f686ae700879] => "session_key=2.ywuLypqlROwDBwmXchOHDw__.3600.1300474800-1121400939&uid=1121400939&expires=1300474800&secret=p44Bzsty0beyEAFdHsabEQ__&base_domain=[site]&access_token=186188211425172%7C2.ywuLypqlROwDBwmXchOHDw__.3600.1300474800-1121400939%7CW9SMjry2qN5-hM6NvDgxN0l4sYc&sig=4c2aa0089d2ee529f36e467ee8474651"
    [__utmb] => 252915730.16.9.1300473035604
    [SESS61f7e61fc29c3d174bbda43779a99a4b] => c7e0d874f95f12b26d22a7da52100e17
    [__utmz] => 252915730.1300456667.36.8.utmcsr=m.[site]|utmccn=(referral)|utmcmd=referral|utmcct=/
    [textsize] => 100
    [__utma] => 252915730.916652299.1299873145.1300464992.1300471134.39
)


REQUEST_URI:
/user/5/edit/[application]
Dave Cohen’s picture

@bcobin, would you mind submitting another issue for that? A fix for that will be in fb_permission.module, and not the same fix for this thread.

bcobin’s picture

With pleasure, Dave. Issue has been reposted at http://drupal.org/node/1097966

Thanks much!