• Resolved Dementei

    (@dementei)


    Updated to the newest Facebook AWD version v1.4. Now whenever I logout of WP (using meta widget) or use the logout from the FB button, it directs me to this error: Facebook AWD Error: (#2500) An active access token must be used to query information about the current user.

    If I logout from the admin bar it directs me to the facebook login page, but it seems when I am not logged into facebook at all, logging in or out is no problem on the site (that is after I login by going to /wp-login.php), but when I am logged into facebook and I logout from the website that error occurs.

    Something is wrong between logging out of the site and out of facebook, but it wasn’t like this before the update. It is a really great plugin, I use it on three of my sites, hope for fix.

    http://wordpress.org/extend/plugins/facebook-awd/

Viewing 15 replies - 1 through 15 (of 20 total)
  • I got the same problem. i hope he can fix it as soon as posible. 😀

    Plugin Author AHWEBDEV

    (@ahwebdev)

    Can you give me more info ? i need to know where this error happens ?
    Wich line of code can you paste the full error report here ? thanks

    Hi, got the same error. After you login with FB and then when you click on WP logout the error shows preventing any page to display.

    The problem might be in the cookies handling. After deleting cookies related to the website (specifically PHPSESSID and fbsr_xxxx) the error disappears.

    Edit:
    It’s your plugin’s generated error so it’s hard to say from which line of code it is generated.
    When enabling WP Debug the following PHP notice shows:
    Notice: ob_end_flush() ref.outcontrol: failed to delete buffer zlib output compression. in /wp-includes/functions.php on line 2504 but I have no clue if it is relevant at all.

    Plugin Author AHWEBDEV

    (@ahwebdev)

    What is your browser ? i need an url to test, as i can’t reproduce the bug.

    It happens on all browsers I tried.
    Don’t have a public URL yet am testing on local environment.

    I nailed the line where the error comes from.
    It’s in AWD_facebook.php line 1899.
    My WP version: 3.4.2.

    Call stack:
    wp-content/plugins/facebook-awd/AWD_facebook.php.AWD_facebook->get_facebook_user_data:1899
    wp-content/plugins/facebook-awd/AWD_facebook.php.AWD_facebook->login:2079
    wp-content/plugins/facebook-awd/AWD_facebook.php.AWD_facebook->login_listener:2070
    wp-content/plugins/facebook-awd/AWD_facebook.php.AWD_facebook->parse_request:2187
    wp-includes/plugin.php.call_user_func_array:484
    wp-includes/plugin.php.do_action_ref_array:484
    wp-includes/query.php.WP_Query->parse_query:1674
    wp-includes/query.php.WP_Query->get_posts:1920
    wp-includes/query.php.WP_Query->query:2941
    wp-includes/class-wp.php.WP->query_posts:460
    wp-includes/class-wp.php.WP->main:524
    wp-includes/functions.php.wp:775
    wp-blog-header.php.require:14
    index.php.{main}:19

    Plugin Author AHWEBDEV

    (@ahwebdev)

    Can you give me the url to logout on your site when your are FB connected ?

    Plugin Author AHWEBDEV

    (@ahwebdev)

    OK so i decoded the url and that give that:
    https://www.facebook.com/logout.php?next=http://mytestdomain.com/facebook-awd/logout?redirect_to=index.php&_wpnonce=b69d42fb25&access_token=AAAEvnD4aoZAgBAGZCRiuSxKHxrrmuAZBZAN8GUm4PGAm28WZBxpEAdoXL0esv1ZCrkZC2y6my8en6xB6IJlaJXAOzdNySFc2AnxcezoO2or9wZDZD

    the strange thing is that redirect_to=index.php normaly, this should redirect to an url on your site.

    I explain:

    When you logout, first we redirect you on facebook to clear facebook session, then facebook redirect you to an special url on your site to clear WP session, then it will redirect you to the url after logout.

    Did you set an url for redirect after login ? It seems this is the problem, as this url is set to “index.php” it’s not a good url

    Alright. Here is what I got so far:
    I’ve changed the option “Url after logout” in your plugin settings. However it didn’t influence shape of the url of WordPress logout link (not the AWD FB logout link). It is still:
    https://www.facebook.com/logout.php?next=http://mytestdomain.com/facebook-awd/logout?redirect_to=index.php&_wpnonce=b69d42fb25&access_token=AAAEv…

    However, I noticed that it does change the logout button generated by your plugin.
    The button name is now the “after logout url” I entered in plugin settings (before it was just the word “Logout”).
    The button code is now:
    <a href="https://www.facebook.com/logout.php?next=http://mytestdomain.com/facebook-awd/logout?redirect_to=http://mytestdomain.com/users/?action=login&_wpnonce=b69d42fb25&access_token=AAAEvn...">http://mytestdomain.com/my-board</a>

    Please notice that redirect_to has value I entered in “Url after login” in plugin settings. And the anchor tag content is: http://mytestdomain.com/my-board which is url which I entered “Url after logout” plugin settings.

    The error still appears no matter which logout link I press.

    I tried to debug it with my humble abilities.

    After clicking logout WP user is being logged out from WP account and from FB account (for whatever reason. I would prefer that I’m still logged in to FB as it is different website).
    Anyway, after redirecting back from FB logout call to the website
    $this->is_user_logged_in_facebook() returns true (line: 2069) which causes chain of other calls which at the end results in the mentioned error.

    What exactly happens:
    $this->login($redirect_url); is called and it checks:
    if ($this->uid) { // which is true (but why if I’m logged out)
    because of that
    $this->get_facebook_user_data(); is called which causes the error.

    The question is why $this->uid is set if I’m supposed to be logged out?

    Furthermore, in line: 1976
    $this->uid = $this->fcbk->getUser();
    user id is returned. But at this particular moment I’m logged out from facebook.

    Another strange behavior, not sure if related
    If I’m logged out from WP it signs me back in after I sign in to Facebook. Is this desired behavior?

    I’m not sure if I can spend more time on this one. Need deliver working solution.

    Me again. So the problem you are facing is exactly same as expressed in this post:
    http://stackoverflow.com/questions/8517934/facebook-getuser-returns-a-userid-after-logout
    The suggested solution is to use function Facebook->api(‘/me’) to determine whether user is logged in.

    So workaround I’ve came up with is changing function is_user_logged_in_facebook() in your plugin to:

    public function is_user_logged_in_facebook()
    {
        try {
            if ($this->fcbk->api('/me') && isset($this->uid) && $this->uid != 0)
                    return true;
        } catch (FacebookApiException $e) {
            if (is_object($this->fcbk))
                    $this->fcbk->destroySession();
            return false;
        }
    }

    For the bug I mentioned before (log out redirect url used as a label and log in url used in log out redirection) I’ll create another thread.

    still not working. this error still showing up.

    http:/site.com/facebook-awd/login

    Facebook AWD Error: (#2500) An active access token must be used to query information about the current user.

    Apply the brutal fix above and clean your browser cookies.
    However, this version of plugin has many other flaws and am not sure if it is usable at this stage.

    Plugin Author AHWEBDEV

    (@ahwebdev)

    Hi,

    If I’m logged out from WP it signs me back in after I sign in to Facebook. Is this desired behavior?

    Yes as you already authorized the app

    You re right, the is_user_logged_in_facebook() is broken. however, using the /me api call will increase the page loading on each page.

    For the bug I mentioned before (log out redirect url used as a label and log in url used in log out redirection) I’ll create another thread.

    thank you, i will follow that.

    Thread Starter Dementei

    (@dementei)

    Glad to see it’s all working out.

    As for me I just switched back to the version before, it may have its flaws but as long as my like box works it’s all good. I can login fine just like before, but I do hope for an improvement in next update, the newer interface is nice too.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘[Plugin: Facebook AWD All in one] Facebook AWD Error: (#2500)’ is closed to new replies.