Using Google OAuth2 for local development requires setting up credentials in the Google Cloud Console, configuring a redirect URI for localhost, and using the Google APIs client library to handle authentication.


1. Create a Google Cloud Project & Enable APIs

  1. Go to Google Cloud Console.
  2. Create a new project or select an existing one.
  3. Navigate to APIs & Services → Library.
  4. Enable the Google Calendar API (or any other API you need).

2. Create OAuth 2.0 Client Credentials

  1. Go to APIs & Services → Credentials.
  2. Click Create Credentials → OAuth Client ID.
  3. Select Web Application as the application type.
  4. Add authorized redirect URIs:
  5. Save and download the credentials.json.

3. Install Google Auth Library

npm install googleapis google-auth-library

4. Implement Local OAuth Flow

Here’s a Node.js example for local dev: