Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Unable to Query Google Calendar API

Not sure if this is the right channel (please direct me to the right support thread if it is not), but I'm trying to integrate Google Calendar API in my python script and keep getting authentication errors, and I'm not sure why. 

Errors:

(running the python script in the terminal):

An error occurred: <HttpError 400 when requesting https://www.googleapis.com/calendar/v3/calendars/primary/events?timeMin=2025-04-09T00%3A45%3A48.396042%2B00%3A00Z&maxResults=10&singleEvents=true&orderBy=startTime&alt=json returned "Bad Request". Details: "[{'domain': 'global', 'reason': 'badRequest', 'message': 'Bad Request'}]">

(Going to the link in the web):

{
  "error": {
    "code": 403,
    "message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
    "errors": [
      {
        "message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}

What I already tried:

  • I added the credentials.json file to my local project folder. When I go to the url specified in the auth_url field, I get "Access blocked: authorisation error"
  • I have the project selected in Google Cloud on https://console.cloud.google.com/
  • I have added a DesktopClient in the Credentials Page as I am sending the request from a python script from my device
  • I also added my email as as Test User under Audience->Test Users
  • In the IAM section on Google Cloud page, my email is added to the Allow section with the Role 'Owner'
  • Audience->Publish status is set to Testing and User Type is External
  • have the Google Calendar API enabled

Relevant Code or Configs:

I run the exact same code as in the quickstart.py file in QuickStart Python instructions for Google Calendar API .I followed all the instructions on that page exactly apart from #2d under Configure the OAuth consent screen, where I had to set the user type to External since I don't plan to ship the product yet, but instead utilize it for my personal use. 

I am also prompted to authorize access through my account when I run the script for the first time, and I authorize everything. 

I searched StackOverflow, google support channels, and other sources, but wasn't able to figure out a solution to this issue. If anyone can help, I would gladly appreciate it !

0 1 202
1 REPLY 1

Hi @Klambert,

Welcome to Google Cloud Community!

It appears that a more thorough investigation of your project is necessary. For more detailed insights you may reach out to Google Workspace Support for assistance.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.