AuthenticationGoogle Login

Google Authentication

Follow these steps to set up Google Authentication.

Step 1: Create a Google Cloud Project

  1. Go to Google Cloud Console.
  2. Create a new project.
  3. Navigate to “APIs & Services” > “Credentials.”
  4. Click “Create Credentials” and select “OAuth 2.0 Client IDs.”
  5. Configure your consent screen and create a new OAuth 2.0 client ID.
  6. Under “Authorized redirect URIs,” add your redirect URL:
    • http://localhost:3000/api/auth/callback/google for local development.
    • https://example.com/api/auth/callback/google for production.

Step 2: Copy Credentials to .env.local

  1. After creating your OAuth credentials, copy the Client ID and Client Secret provided by Google.
  2. In your project’s .env.local file, add the following environment variables, and paste the values.
    • GOOGLE_CLIENT_ID
    • GOOGLE_CLIENT_SECRET