Calendar API doesn't work with service accounts
See original GitHub issueI am trying to use the calendar API to create secondary calendars and access calendar events:
Code
const token = await jwtAuth()
const api = google.calendar({ version: 'v3', auth: token })
const calendarId = 'someexample_rd59mrlsetc9dp2snre44r54bo@group.calendar.google.com'
const response = await api.calendars.get({ calendarId, auth: token })
This throws an error saying:
UnhandledPromiseRejectionWarning: Error: Login Required
warning.js:18
at Gaxios.<anonymous> (/Users/sauravchandra/Documents/NodeProjects/CalendarApi/node_modules/gaxios/build/src/gaxios.js:64:27)
at Generator.next (<anonymous>)
at fulfilled (/Users/sauravchandra/Documents/NodeProjects/CalendarApi/node_modules/gaxios/build/src/gaxios.js:16:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
Scopes: https://www.googleapis.com/auth/calendar
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Google Calendar API Service Account Error - Stack Overflow
1 - Provide calendar scopes to your service account. Go to https://admin.google.com/ and login with G Suite account. · 2 - Your user...
Read more >Can't create an event when using service account credentials
According to the reply from Google on the issue tracker, either your service account has to create the calendar in question, or you...
Read more >Google API and Service Accounts: Get Up and Running in 30 ...
A comprehensive, step-by-step guide to help you set up Salesforce and Google in order to make authenticated callouts to Google APIs.
Read more >Service account is unable to invite calendar ... - Issue Tracker
A short description of the issue: We use the Ruby client to request Google Calendar API using the service account. ... The issue...
Read more >Accessing calendars from service account - Google Groups
Do I need to manually add the service account email to those calendars or ... documentation that says that the calendar API does...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @sauravexodus, I tried the following way using a service account.
Let me know if it works for you.
I wrote my own wrappers around the REST API.