• Resolved klode

    (@klode)


    Hi,
    in my website it works fine, as on many other websites with the same version of WordPress.
    But on http://klode.altervista.org I get this error:

    <b>Fatal error</b>:  Uncaught exception 'Google_AuthException' with message 'Could not json decode the token' in /membri2/klode/wp-content/plugins/google-analytics-dashboard-for-wp/src/auth/Google_OAuth2.php:153
    Stack trace:
    #0 /membri2/klode/wp-content/plugins/google-analytics-dashboard-for-wp/src/auth/Google_OAuth2.php(104): Google_OAuth2->setAccessToken('Protection: 1; ...')
    #1 /membri2/klode/wp-content/plugins/google-analytics-dashboard-for-wp/src/Google_Client.php(131): Google_OAuth2->authenticate(Array, '4/ewERQTDvMRcIO...')
    #2 /membri2/klode/wp-content/plugins/google-analytics-dashboard-for-wp/ga_dash.php(339): Google_Client->authenticate('4/ewERQTDvMRcIO...')
    #3 [internal function]: ga_dash_content('', Array)
    #4 /membri2/klode/wp-admin/includes/template.php(925): call_user_func('ga_dash_content', '', Array)
    #5 /membri2/klode/wp-admin/includes/dashboard.php(204): do_meta_boxes('dashboard', 'normal', '')
    #6 /membri2/klode/wp-admin/index.php(129): wp_dashboard()
    #7 {main}
      thrown in <b>/membri2/klode/wp-content/plugins/google-analytics-dashboard-for-wp/src/auth/Google_OAuth2.php</b> on line <b>153</b><br />

    Infact I get this JSON string (it’s not a real JSON string!):

    Protection: 1; mode=block
    Server: GSE
    Alternate-Protocol: 443:quic
    Transfer-Encoding: chunked
    
    {
      "access_token" : [redacted],
      "token_type" : "Bearer",
      "expires_in" : 3600,
      "refresh_token" : [redacted]
    }

    How can I resolve this issue?

    http://wordpress.org/plugins/google-analytics-dashboard-for-wp/

Viewing 8 replies - 1 through 8 (of 8 total)
  • @klode: OMG, edit your post and remove the access_token and refresh_token immediately!

    @ipstenu or @esmi please moderate that value, if the user won’t do it.

    Access & refresh token values removed.

    @klode: Never ever post tokens or any other sensitive information on a public forum.

    Google API has an issue when websites are behind a proxy, like those hosted by altervista.

    can you try to go to src/io/Google_CurlIO.php

    and add

    $respData = preg_replace('/^HTTP.+HTTP/is', 'HTTP', $respData);

    before

    // Parse out the raw response into usable bits
        list($responseHeaders, $responseBody) =
              self::parseHttpResponse($respData, $respHeaderSize);

    Keep in mind that a plugin update will overwrite the fix.

    Thread Starter klode

    (@klode)

    Thanks… I’ll try right now!

    Thread Starter klode

    (@klode)

    After apply the editings on Google_curlIO.php, I get this new error:

    Invalid json in service response:
    Help on WordPress Forum
    Support on Deconf Forum

    what do you think? Does some other problem regarding Altervista?

    Thread Starter klode

    (@klode)

    In the configuration page, I get this:

    Lock selected access level to this profile:

    with a red arrow, and the text:

    your profile list needs an update: Click here

    And when I click on link, I get the dashboard, with the error above.

    That red warning is generated by the fact that the plugin is unable to get to the step of retrieving the profiles list. It can’t get there because there is a JSON error (your error log should contain more details)

    I think altervista’s platform is not compatible with the GAPI client library. You should also have a look here: http://wordpress.org/support/topic/dashboard-error-8?replies=27

    Being a new error I thought we could make it work, but I guess we can’t.

    Thread Starter klode

    (@klode)

    Hi,
    I’ve found a possible solution on the file Google_CurlIO.php.

    The problem is that $respHeaderSize is not correct in some case. So the line 122 of this file can be replace from:

    $respHeaderSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);

    to:

    $respHeaderSize = strpos($respData, "{");

    I wish this solution can be good! 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Could not json decode the token’ is closed to new replies.