Skip to content

Google Analytics wrong result #131

Description

@anddimario

Hi, only for some analytics request we have this error:

<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head><title>Google Accounts</title><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0\" /><link rel='stylesheet' type='text/css' href='https://ssl.gstatic.com/accounts/o/1893590695-error_page_css_ltr.css'>\n<script type=\"text/javascript\" src=\"https://ssl.gstatic.com/accounts/o/4240385162-common_lib.js\"></script>\n<style>@media screen and (max-width:500px) {#robot {background: none; min-height: 0; min-width: 0; padding: 0;}#stack_trace {display: none;}}\n#oauth2_request_info_header {background-image: url(\"https://ssl.gstatic.com/accounts/o/blank.gif\");}</style></head>
<body ><div id=\"robot\"></div><a href=\"//www.google.com/\" id=\"googlelogo\"><img src=\"//www.google.com/images/logo_sm.gif\" alt=\"Google\"></a><p class=\"large\"><b>403.</b> <ins>That's an error.</ins></p><p class=\"large\">You are not authorized to perform this request.  <ins>That's all we know.</ins></p></body>
</html>

It's displayed not as error, in the callback, but as normal result.

Have someone some suggestions about this problem?

Thanks for your time.
Best regards.

Activity

  1. rakyll commented on Jan 22, 2014

    @rakyll
    Contributor

    What's your request? Could you share a snippet?

  2. anddimario commented on Jan 22, 2014

    @anddimario
    Author

    Hi, yes, sorry, here: https://gist.github.com/anddimario/8559849

    Thanks for your time.
    Best regards.

  3. rakyll commented on Jan 24, 2014

    @rakyll
    Contributor

    I'm not able to reproduce, would you like to share your request_object? Which googleapis version you're depending on?

  4. anddimario commented on Jan 24, 2014

    @anddimario
    Author

    Hi, i've edited the gist with the complete object ( https://gist.github.com/anddimario/8559849 ). I'm using the npm version 0.4.7. I'm doing other tests, it seems that the problem is the requests number (but it's not a normal rate limit error) and not the single metrics, i've tryed to refresh the tokens for each request without results.

    Thanks for your time.
    Best regards.

  5. rakyll commented on Jan 24, 2014

    @rakyll
    Contributor

    I'm looking at your code, and if a refresh token is invalid, there are multiple token refreshing requests are made concurrently which is racy and may malform the request body. The best approach is to refresh the token manually if oauth2client.credentials. expires_in is likely to happen soon.

    Qps related errors will returns a rate limit error which has a valid JSON body.

    On the other hand, IMHO, client library is doing a bad job while handling token refreshes and I've initiated ideas several times in the past to fix it. But, the expectations of developers in terms of the default behavior on token expires were very diverse and wrapping a solution into OAuth2Client was not meeting everyone's needs.

  6. anddimario commented on Jan 24, 2014

    @anddimario
    Author

    Hi, understood, really thanks, i'll do some test based on your suggestions. Only one last thing, is the expires_in available from the module, or should i make a direct http request to google api to get this? On oauth2client i've only: access_token, refresh_token and token_type.

    Thanks for your time.
    Best regards.

  7. ryanseys commented on Jul 31, 2014

    @ryanseys
    Contributor

    Just released 1.0.3 which likely addresses this issue. The access token will be refreshed prior to initial request if has expired or is missing and you have a refresh token set. If the request fails due to a missing, invalid, or revoked access token, we will no longer attempt to refresh and re-attempt the request.

    https://github.com/google/google-api-nodejs-client/releases/tag/1.0.3

  8. ryanseys commented on Aug 8, 2014

    @ryanseys
    Contributor

    We have tried to make it as straightforward and well documented as possible so as to avoid making incorrectly formatted requests, especially around refreshing access tokens. Closing this as I believe we have eliminated this issue, especially around checking expires_in and using it to automatically refresh the access token before making requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions