1

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?

3
  • Where is this application running? Commented Oct 29 at 21:43
  • Running on a linux server. Commented Oct 30 at 9:35
  • always put full error message (traceback) because there are other useful information. Commented Nov 1 at 0:48

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.