Skip to content

feat: add Google OAuth authentication #4

Description

@Jnanamithran

Feature Request

Problem Statement

Currently Inquira only supports email/password authentication.
Adding Google OAuth would make it significantly easier for users
to sign up and log in — reducing friction during onboarding.

Proposed Solution

Add Google OAuth 2.0 as an authentication option alongside
the existing email/password flow.

Frontend changes

  • Add "Continue with Google" button on Login and Register pages
  • Handle OAuth redirect and token exchange
  • Store JWT token same as existing auth flow

Backend changes

  • Install passport and passport-google-oauth20
  • Add Google OAuth strategy
  • Add routes:
    • GET /api/auth/google — redirect to Google
    • GET /api/auth/google/callback — handle callback
  • On first login: auto-create user and organization
  • On subsequent logins: return existing user JWT

Database changes

  • Add googleId field to User model in Prisma schema
  • Make password field optional (Google users won't have one)

Environment variables needed

GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=https://your-backend-url/api/auth/google/callback

Implementation Steps

  1. Create Google OAuth app in Google Cloud Console
  2. Update Prisma schema — add googleId, make password optional
  3. Install passport packages in backend
  4. Add Google OAuth strategy and routes
  5. Update Login and Register pages with Google button
  6. Test full OAuth flow

Acceptance Criteria

  • "Continue with Google" button visible on Login page
  • "Continue with Google" button visible on Register page
  • Clicking button redirects to Google consent screen
  • After consent, user is logged in and redirected to /dashboard
  • New users get an organization auto-created
  • Existing Google users are recognized on subsequent logins
  • Works in production (Vercel + Render)

Labels

enhancement, auth, frontend, backend

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions