I need some help, I have an application running on GAE and this read some information from a internet page and put inside my calendar as events.

And after google changed the API to v3, I can't connect using my own gmail.
Before that I was using CalendarService passing the credentials (email and app password).

Now I need to use another email created from OAuth2, but when I created an event, this event was created to "primary" calendar of this new email.

How can I connect using my own email and put these events inside the correct calendar and not the primary one?

Thanks for your help and time.
Celso

---

EDIT

I tried to read the calendar list but it's empty. I think that it's because the email that I use to connect using OAuth2, but I'm not sure about it.

Take a look, please.

Thx for your time.

`protected Calendar getCalendarService() throws GeneralSecurityException, IOException {`

```
    HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    JacksonFactory jsonFactory = JacksonFactory.getDefaultInstance();

    Credential credential = new GoogleCredential.Builder()
        .setTransport(httpTransport)
        .setJsonFactory(jsonFactory)
        .setServiceAccountId("xxxxxxxx@developer.gserviceaccount.com")
        .setServiceAccountPrivateKeyFromP12File(new File("cert.p12"))
        .setServiceAccountScopes(Collections.singleton(CalendarScopes.CALENDAR))
        .build();

    return new Calendar.Builder(httpTransport, jsonFactory, credential).setApplicationName("appname").build();
}

```