I have an application that needs to read events from a google calendar. I am trying to use a service account as that seems appropriate. My code is:
from googleapiclient.discovery import build from google.oauth2 import service_account SCOPES = 'https://www.googleapis.com/auth/calendar.readonly' credentials = service_account.Credentials.from_service_account_file('service_account_credentials.json', scopes=SCOPES) service = build('calendar','v3', credentials=credentials) events_request = service.events().list(calendarId='primary',singleEvents=True,orderBy='startTime') while events_request is not None: last_response = events_request.execute() I get the error message:
google.auth.exceptions.RefreshError: ('No access token in response.', {'id_token': ...' I have given the service account owner role and shared the calendar with its email address. What am I missing?