0

I have enabled the proper API in the Google console. That is not the issue. I need to write a node js app which accesses user's data when they are offline. I have managed to implement oauth2 authorization, and have gotten a refresh_token, which I later used to get a fresh access token.

Now I've gotten to the point of actually accessing the API's themselves. I have this URL which works perfectly when called with curl from the shell:

curl https://www.googleapis.com/calendar/v3/calendars/primary/events?access_token=mytoken

It returns a JSON with all the events, and works constantly. No matter how many times I call it.

Yet the exact same URL fails when pasted in the address bar of any browser.

Here's the response sent by Google:

{
"error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceededUnreg",
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
    "extendedHelp": "https://code.google.com/apis/console"
   }
  ],
  "code": 403,
  "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
 }
}

It also fails with the same exact error when called from the server's side in node js using "request" module as follows:

request('https://www.googleapis.com/calendar/v3/calendars/primary/events?token=mytoken', function(err, httpResponse, body){ /* ..print body or fail.. */ }

All my google-api related searches lead to (almost) the same pages.

Does anyone have any idea what I am doing wrong?

  • Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup its obvious go to https://code.google.com/apis/console and register your application there – Yamen Nassif Aug 08 '16 at 14:07
  • 1
    http://stackoverflow.com/questions/13512203/error-code-403-in-google-api http://stackoverflow.com/questions/19335503/keep-getting-a-daily-limit-for-unauthenticated-use-exceeded-continued-use-requ – Yamen Nassif Aug 08 '16 at 14:08
  • They throw the "exceeded use" error a lot of the time when that's not actually the reason. If that ^^ isn't any help, try posting the data rather than putting it in the querystring. – Reinstate Monica Cellio Aug 08 '16 at 14:09
  • Thank you for the comments, guys: Just so I could double-check - I went to my google console and indeed calendar API is enabled. And as a reminder: in my question I wrote that the API request actually does indeed **work** - but only in curl (get request). I deduce that it should theoretically work perfectly in a browser, and in node. – David Mauas Aug 08 '16 at 14:12

1 Answers1

0

Using the alternate method proposed by Google I am getting consistent results both on cURL in shell, and in node: I have removed the access_token GET query parameter And I am adding the following header: - "Authorization: Bearer ACCESS_TOKEN_HERE"

Works. Thanks for the comments.