Google Auth Setup
Prime supports Google OAuth so users can sign in with their Google account instead of a password.
1. Create a Google Cloud project
Go to console.cloud.google.com and create a new project (or use an existing one).
2. Enable the Google+ API
In your project, go to APIs & Services → Library and enable the Google+ API (or Google Identity).
3. Create OAuth credentials
Go to APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client ID.
- Application type: Web application
- Authorized JavaScript origins:
http://localhost:3300
https://yourdomain.com - Authorized redirect URIs:
http://localhost:6600/auth/google/callback
https://api.yourdomain.com/auth/google/callback
Copy the Client ID and Client Secret.
4. Configure environment variables
In demo-server/.env:
GOOGLE_CLIENT_ID=your_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-your_secret
5. Set the production domain
PRODUCTION_DOMAIN=https://yourdomain.com
This is used to build the correct OAuth callback URL in production.
How it works
When a user clicks "Sign in with Google", the frontend redirects to /auth/google. The backend uses google-auth-library to verify the token returned by Google and either signs in the existing user or creates a new account. The Google subject ID is stored on the users table for future logins.