This project implements Google Calendar integration using Django REST API. The project utilizes OAuth2 authentication to obtain events from user's calendar after getting the access to user's calendar.
- Used Django Framework to integrate Google Calendar.
- It does not rely on any third-party libraries other than Google's provided standard libraries.
- Clone the repository
git clone https://github.com/0xt3j4s/Google-Calendar-Integration-API.git
- Move to the project directory
cd Google-Calendar-Integration-API
- Move to the
google_calendar_integ
directory
cd google_calendar_integ
-
Configure the project settings, including the Google API credentials and changing the production secret in
settings.py
. -
Run the server
python manage.py runserver
- Initialize Google Calendar Integration
- Endpoint:
/rest/v1/calendar/init/
- View:
GoogleCalendarInitView
This endpoint starts step 1 of the OAuth2 process. It gets the user's credentials and saves the state so the callback can verify the auth server response.
- Handle redirect from Google OAuth2 and get list of events from user's calendar
- Endpoint:
/rest/v1/calendar/redirect/
- View:
GoogleCalendarRedirectView
This endpoint handles redirect request sent by google, fetched the access token and then gets a list of 10 events from user's calendar.
As of now, it only fetches the events from the 1st-31st May 2023. This can be changed by changing the timeMin
and timeMax
parameters in the get_events
method of GoogleCalendarRedirectView
class.
The events are rendered in a simple HTML page. The output is shown below: