Search code examples
google-apigoogle-calendar-apigoogle-oauthgoogle-authenticationauthsub

Google Calendar Events Response is Empty


We are fetching google calendar events through OAuth2 tokens with Google Calendar API V3 to our customers, but for some of customers' calendar getting empty response. We got empty response for the same calendar in Google OAuth Playground.

{
  "nextPageToken": "CjkKK2xwamMycHJ2MDU2cGp2YFxcmY3OXRtNTg0XzIwMTQwMjEyVDA0MzAwMFoYASCAgMDEtcaFoBQaDQgAEgAY2M-X7qfLvAI=", 
  "kind": "calendar#events", 
  "defaultReminders": [
    {
      "minutes": 30, 
      "method": "popup"
    }
  ], 
  "items": [], 
  "updated": "2014-02-14T09:32:57.943Z", 
  "summary": "TEST", 
  "etag": "\"TuPKiPtcUnaxp3U8BefUMu26Bg/LWnnxrAP6L1-mgjBDhy0rIebYaE\"", 
  "timeZone": "Asia/Calcutta", 
  "accessRole": "owner"
}

But when the same user is authenticated through AuthSub, it is fetching the events list. Is anyone having the same issue? Any help would be appreciated.

TIA, Riyaz.A


Solution

  • We can't set pageToken to the event instance

    Calendar.Events.List events = service.build().events().list(gCalId);
    

    But when we try model Events instance, we able to set pageToken and got response too

    com.google.api.services.calendar.model.Events events = service.build().events().list(gCalId).setPageToken(pageToken).execute();