Google OAuth Setup Guideď
This guide explains how to set up Google Sign-In for PutPlace.
Overviewď
PutPlace supports two authentication methods:
Username/Password - Traditional local authentication
Google Sign-In - OAuth 2.0 authentication using Google accounts
With Google Sign-In enabled, users can:
Sign in with their existing Google account
Skip the registration process
Use a more secure authentication method (no password storage needed)
Prerequisitesď
A Google Account
Access to Google Cloud Console
PutPlace server running (backend)
Step 1: Create Google OAuth Credentialsď
1.1 Create a Google Cloud Projectď
Go to Google Cloud Console
Click âSelect a projectâ â âNew Projectâ
Enter project name:
PutPlace(or your preferred name)Click âCreateâ
Wait for project creation to complete
1.2 Enable Google Sign-In APIď
In Google Cloud Console, ensure your new project is selected
Go to âAPIs & Servicesâ â âLibraryâ
Search for âGoogle+ APIâ or âGoogle Identityâ
Click âEnableâ
1.3 Configure OAuth Consent Screenď
Go to âAPIs & Servicesâ â âOAuth consent screenâ
Select âExternalâ user type (unless you have a Google Workspace account)
Click âCreateâ
Fill in required fields:
App name: PutPlace Client
User support email: Your email
Developer contact information: Your email
Click âSave and Continueâ
Skip âScopesâ section (click âSave and Continueâ)
Add test users if needed (optional)
Click âSave and Continueâ
1.4 Create OAuth 2.0 Credentialsď
Go to âAPIs & Servicesâ â âCredentialsâ
Click âCreate Credentialsâ â âOAuth 2.0 Client IDâ
Select âWeb applicationâ as application type
Enter name:
PutPlace Web ClientAdd Authorized JavaScript origins:
http://localhost:8000 http://127.0.0.1:8000
If deploying to production, add your production URL:
https://your-domain.com
Leave âAuthorized redirect URIsâ empty (not needed for ID token flow)
Click âCreateâ
Save your Client ID - it will look like:
123456789-abcdefghijk.apps.googleusercontent.com
Step 2: Configure PutPlace Serverď
2.1 Add OAuth Configuration to ppserver.tomlď
Edit your ppserver.toml file and add/update the [oauth] section:
[oauth]
google_client_id = "YOUR_CLIENT_ID.apps.googleusercontent.com"
Replace YOUR_CLIENT_ID with the actual Client ID from Google Cloud Console.
Example ppserver.toml:
# PutPlace Server Configuration
[database]
mongodb_url = "mongodb://localhost:27017"
mongodb_database = "putplace"
mongodb_collection = "file_metadata"
[api]
title = "PutPlace API"
description = "File metadata storage API"
[storage]
backend = "local"
path = "./storage/files"
[oauth]
google_client_id = "123456789-abcdefghijk.apps.googleusercontent.com"
2.2 Alternative: Environment Variableď
You can also set the Client ID via environment variable:
export GOOGLE_CLIENT_ID="YOUR_CLIENT_ID.apps.googleusercontent.com"
2.3 Restart PutPlace Serverď
After configuration, restart the server:
invoke quickstart
# Or manually:
pp_server restart
Step 3: Test Google Sign-Inď
3.1 Launch Electron GUIď
invoke gui-electron
3.2 Sign In with Googleď
On the login page, you should see:
Username/Password fields
âORâ separator
âSign in with Googleâ button
Click âSign in with Googleâ
Google popup will appear
Select your Google account
Authorize the app (first time only)
Youâll be automatically signed in to PutPlace
3.3 Verify Loginď
Check that auth status shows your username
You should be redirected to the main app screen
Try uploading files to verify the JWT token works
Troubleshootingď
âGoogle OAuth not configuredâ Errorď
Problem: Server returns error about OAuth not configured
Solution:
Verify
ppserver.tomlhas[oauth]section withgoogle_client_idVerify Client ID format (should end with
.apps.googleusercontent.com)Restart server:
pp_server restart
âInvalid Google ID tokenâ Errorď
Problem: Login fails with invalid token error
Possible causes:
Wrong Client ID: Frontend and backend Client IDs donât match
Origin mismatch: JavaScript origin not authorized in Google Console
Expired credentials: Token expired before verification
Solution:
Verify Client ID in Google Cloud Console matches
ppserver.tomlAdd
http://localhost:8000to Authorized JavaScript originsClear browser cache and try again
âEmail not verifiedâ Errorď
Problem: Google Sign-In fails with âEmail not verified by Googleâ
Solution:
Use a Google account with verified email
Verify your email in Google Account settings
Security Considerationsď
What Gets Storedď
When a user signs in with Google:
User email (from Google)
Full name (from Google)
Profile picture URL (from Google)
OAuth provider (
"google")OAuth ID (Google user ID - unique identifier)
NOT stored:
Google password
Google access tokens
Any other Google account data
Token Flowď
User clicks âSign in with Googleâ
Google popup appears (handled by Google)
User authorizes app
Google returns ID token to frontend
Frontend sends ID token to PutPlace backend
Backend verifies token with Google servers
Backend creates/updates user in database
Backend returns PutPlace JWT token
Client uses JWT for subsequent API calls
Client Secret Not Neededď
The ID token flow doesnât require a client secret because:
Verification happens server-side using Googleâs public keys
ID tokens are cryptographically signed by Google
Backend validates signature and claims directly with Google
Production Deploymentď
HTTPS Requiredď
Google Sign-In requires HTTPS in production. Exceptions:
localhost(development)127.0.0.1(development)
Additional Resourcesď
Supportď
If you encounter issues:
Check server logs:
pp_server logs --followCheck browser console for JavaScript errors
Verify MongoDB is running:
invoke mongo-statusTest backend endpoint:
curl http://localhost:8000/api/oauth/config
Example: Testing with cURLď
Test the Google OAuth flow manually:
# 1. Get OAuth config
curl http://localhost:8000/api/oauth/config
# 2. (After getting ID token from Google)
curl -X POST http://localhost:8000/api/auth/google \
-H "Content-Type: application/json" \
-d '{"id_token":"YOUR_GOOGLE_ID_TOKEN_HERE"}'
# Should return:
# {"access_token":"eyJ...","token_type":"bearer"}