This Node.js application demonstrates integration with the Google Calendar API. It allows users to authenticate via Google, list their calendars, and view upcoming events in their Google Calendar.
- OAuth2 Google Authentication
- Listing all Google Calendars
- Viewing upcoming events in specified Google Calendars
- Node.js installed on your machine
- A Google Cloud Platform account
- A project created in the Google Developers Console with the Google Calendar API enabled
- OAuth 2.0 credentials (Client ID and Client Secret) in your Google project
- Clone the repository:
git clone https://github.com/adanzweig/nodejs-google-calendar.git - Navigate to the project directory:
cd nodejs-google-calendar - Install the required dependencies:
npm install - Create a
.envfile in the root of your project and add your Google OAuth2 credentials:CLIENT_ID=your_client_id SECRET_ID=your_client_secret REDIRECT=your_redirect_uri - Start the server:
npm start
- Open your browser and navigate to
http://localhost:3000. - You will be redirected to the Google sign-in page.
- After signing in and granting permissions, you will be redirected back with a message indicating a successful login.
- Access
http://localhost:3000/calendarsto list all your Google Calendars. - Access
http://localhost:3000/eventsto list the upcoming events from your primary Google Calendar. You can specify a different calendar by adding?calendar=your_calendar_idto the URL.
Contributions are welcome. Please open an issue first to discuss what you would like to change or add.