I implemented an utility to perform background operation using Google Calendar API and server side authentication flow without user interface. Now I would like to read events from a private calendar without using authorization flow with offline access or put calendar public.
I'm using this code for authentication:
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(SchedulerCalendar.HTTP_TRANSPORT)
.setJsonFactory(SchedulerCalendar.JSON_FACTORY)
.setServiceAccountId(SchedulerCalendar.SERVICE_ACCOUNT_EMAIL)
.setServiceAccountScopes(SchedulerCalendar.SCOPES)
.setServiceAccountPrivateKeyFromP12File(new File("key.p12")).build();
And the following for read calendar events:
List eventslist = calendar.events().list(calendarid);
The response is 404 for calendar not found.
Any suggestion?