# OAuth with Google and GitHub

This guide will walk you through the process of setting up OAuth authentication for your app using Google and GitHub. You'll need to create OAuth applications on both platforms and retrieve the necessary credentials.

### Google OAuth Setup

1. **Create a Google Cloud Project**
   * Go to the [Google Cloud Console](https://console.cloud.google.com/)
   * Create a new project or select an existing one
2. **Enable the Google+ API**
   * In the sidebar, navigate to "APIs & Services" > "Library"
   * Search for "Google+ API" and enable it
3. **Create OAuth 2.0 Credentials**
   * Go to "APIs & Services" > "Credentials"
   * Click "Create Credentials" and select "OAuth client ID"
   * Choose "Web application" as the application type
   * Set the authorized JavaScript origins to your app's URL (e.g., `http://localhost:3000` for local development)
   * Set the authorized redirect URI (e.g., `http://localhost:3000/api/auth/callback/google`)
4. **Retrieve Google Credentials**
   * After creating the OAuth client, you'll see the client ID and client secret
   * Save these as `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` respectively

### GitHub OAuth Setup

1. **Create a GitHub OAuth App**
   * Go to your GitHub account settings
   * Navigate to "Developer settings" > "OAuth Apps"
   * Click "New OAuth App"
2. **Register the OAuth App**
   * Enter your app name
   * Set the homepage URL to your app's main URL
   * Set the Authorization callback URL (e.g., `http://localhost:3000/api/auth/callback/github`)
3. **Retrieve GitHub Credentials**
   * After registering, you'll see the client ID
   * Generate a new client secret
   * Save these as `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` respectively

### Configuring Your App

1. **Set Environment Variables**
   * In your project's `.env` file, add the following lines:

     ```bash
     GOOGLE_CLIENT_ID=your_google_client_id_here
     GOOGLE_CLIENT_SECRET=your_google_client_secret_here
     GITHUB_CLIENT_ID=your_github_client_id_here
     GITHUB_CLIENT_SECRET=your_github_client_secret_here
     ```
   * Replace the placeholders with your actual credentials
