Wp3Dev
Wp3Dev

Reputation: 2079

Getting Google Calendar Events with React Native (Expo) using API KEY

I am trying to list my own calendar events on my app using my Google API API_KEY but it isn't working. Is this possible without authenticating a user since I only want to display my calendar?

Something Like:

var response = await fetch(`${googleApiConfig.calendarBaseUrl}/calendar/calendars/${calendarId}? 
key=${googleApiConfig.key}`)
var json = await response.json()

Where calendarId (the calendar I am fetching) belongs to me. I don't want to grab other peoples calendar...

Upvotes: 0

Views: 1254

Answers (1)

Wp3Dev
Wp3Dev

Reputation: 2079

I figured out that the resource I was attempting to fetch was requiring OAuth 2.0. In order to fetch an event list of a specific calendar you need to use the following api endpoint:

https://www.googleapis.com/calendar/v3/calendars/${CALENDAR_ID}/events?key=${API_KEY}

Accessing /events on a calendar doesn't require authentication using OAuth 2.0

Upvotes: 3

Related Questions