Skip to content

Commit

Permalink
Fixed scope
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoffat committed Jan 20, 2025
1 parent 07d1a58 commit 05c65d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn-error.log*

# secrets
calendar-service-account.json
calendar-service-account2.json

# gatsby files
.cache/
Expand Down
17 changes: 11 additions & 6 deletions src/api/signup-submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@ export default async function handler(req, res) {

// Scopes required for the Google Calendar API
const SCOPES = [
'https://www.googleapis.com/auth/calendar.events'
'https://www.googleapis.com/auth/calendar'
];

// Create a JWT client using the service account key
const auth = new google.auth.GoogleAuth({
keyFile: SERVICE_ACCOUNT_FILE,
scopes: SCOPES,
clientOptions: {
subject: 'rob.moffat@finos.org', // Specify the user to impersonate
},
});

//const client = auth.getClient()

// Create a Calendar API client
const calendar = google.calendar({ version: 'v3', auth });

Expand All @@ -46,11 +51,11 @@ export default async function handler(req, res) {
}


// const done = await calendar.events.patch({
// calendarId: calendarId,
// eventId: eventId,
// resource: event2
// })
const done = await calendar.events.patch({
calendarId: calendarId,
eventId: eventId,
resource: event2
})

res.json(`ok bebob ${JSON.stringify("hello")}`)
}

0 comments on commit 05c65d4

Please sign in to comment.