Skip to content

Implement Google SSO (OAuth2) – Backend #82

@Alexandrbig1

Description

@Alexandrbig1

Priority: High
Difficulty: Advanced
Type: Backend Feature


Description:
Set up Google Single Sign-On (SSO) in the CoreX backend. The goal is to allow users to register/login with their Google account.


Requirements:

  • Install and configure Google OAuth 2.0:
    • Either with passport-google-oauth20 or google-auth-library.
  • Create endpoints:
    • GET /auth/google – redirect to Google login.
    • GET /auth/google/callback – handle Google’s response.
  • Flow:
    • Verify Google profile (id, email, name).
    • If user exists → return JWT.
    • If new user → create in MongoDB (authProvider: 'google'), then return JWT.
  • Securely store required environment variables:
    • GOOGLE_CLIENT_ID
    • GOOGLE_CLIENT_SECRET
    • GOOGLE_CALLBACK_URL
  • Document usage in README.

Acceptance Criteria:

  • User can authenticate with Google and receive a JWT.
  • New Google users are automatically saved in DB.
  • Errors (invalid token, failure to fetch user) are handled.
  • API is documented for frontend use.

Metadata

Metadata

Labels

advancedComplex/advanced tasks or featuresauthAuthentication & authorizationbackendIssues related to backendgoogle-ssoGoogle Single Sign‑On / OAuthhacktoberfestSpecial issue for Hacktoberfesthacktoberfest-2025Special issue for Hacktoberfest 2025priority: highNeeds attention ASAP

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions