Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
Google Calendar API not returning attendees when listing events

When retrieving events using the Google Calendar Api v3 the attendees array is not included in the results. I'm authenticating with a service account, so there should be no access restrictions on individual fields.

My request looks like this (authentication code omitted for brevity):

async function fetchEvents() {
  const calendar = google.calendar('v3')
  google.options({ auth: await auth() })

  return await calendar.events.list({
    calendarId:
      '<the-actual-calendar-id>@group.calendar.google.com',
    fields:
      'items(summary,description,attendees)',
    maxAttendees: 99,
    timeMin: new Date().toISOString(),
    maxResults: 5,
    singleEvents: true,
    orderBy: 'startTime'
  })
}

Omitting the fields parameter entirely also doesn't include the attendees although the field is part of the Events Resource.

Likewise, omitting maxAttendees also doesn't change anything.

Following the htmlLink returned from the API, I can verify that a particular event has a list of attendees.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Sounds like you have not set up delegation properly. When you delegate to the user in your workspace domain. That user has access on the domain for the-actual-calendar-id>@group.calendar.google.com

Then you init impersonation with the with_subject .

from google.oauth2 import service_account

SCOPES = ['https://www.googleapis.com/auth/calendar']
SERVICE_ACCOUNT_FILE = '/path/to/service.json'

credentials = service_account.Credentials.from_service_account_file(
        SERVICE_ACCOUNT_FILE, scopes=SCOPES)

delegated_credentials = credentials.with_subject('user@example.org')
about 4 years ago · Juan Pablo Isaza Relatório

0

As pointed out in DalmTo's answer an event's attendees is a privileged field that can't be retrieved with a service account unless it is used to impersonate the calendar's owner.

Setting up a service account to impersonate a user

  1. Enable domain-wide delegation for the service account in the Admin Console. The OAuth scope required is https://www.googleapis.com/auth/calendar.events.

  2. Use google.auth.JWT to impersonate the user (from this GitHub issue):

  const auth = google.auth.JWT({
    subject: 'user@your-workspace-domain.com',
    keyFile: '/path/to/service-account-keyfile.json',
    scopes: ['https://www.googleapis.com/auth/calendar.events']
  })

  const calendar = google.calendar({ version: 'v3', auth })

  const { data } = await calendar.events.list({ ... })
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda