Google OAuth Setup for PutPlaceď
This guide will walk you through setting up Google Sign-In for your PutPlace server and Electron client.
Prerequisitesď
A Google account
PutPlace server running (v0.5.1 or later)
Access to Google Cloud Console
Step 1: Create Google Cloud Projectď
Go to Google Cloud Console
Click Select a project dropdown at the top
Click New Project
Enter project name (e.g., âPutPlaceâ)
Click Create
Wait for project creation, then select your new project
Step 2: Enable Google Sign-In APIď
In the left sidebar, go to APIs & Services > Library
Search for âGoogle Sign-In APIâ or âGoogle Identityâ
Click Google+ API (contains Sign-In functionality)
Click Enable
Wait for the API to be enabled
Step 3: Create OAuth 2.0 Credentialsď
Configure OAuth Consent Screenď
Go to APIs & Services > OAuth consent screen
Select External (unless you have Google Workspace)
Click Create
Fill in required fields:
App name:
PutPlaceUser support email: Your email
Developer contact: Your email
Click Save and Continue
Scopes: Click Save and Continue (default scopes are fine)
Test users: Add your email address
Click Save and Continue
Review and click Back to Dashboard
Create OAuth Client IDď
Go to APIs & Services > Credentials
Click + Create Credentials > OAuth client ID
Select Application type: Web application
Enter name:
PutPlace Web ClientUnder Authorized JavaScript origins, click + Add URI:
For local development:
http://localhost:8000For production:
https://your-domain.com
Under Authorized redirect URIs:
Leave empty (not needed for ID token flow)
Click Create
Important: Copy your Client ID
Format:
123456789-abcdefghijklmnop.apps.googleusercontent.comYouâll need this in the next step
Click OK (you donât need the Client Secret)
Step 4: Configure PutPlace Serverď
You have two options to configure the server:
Option A: Using ppserver.toml (Recommended)ď
Open
ppserver.tomlin your PutPlace directoryFind the
[oauth]sectionPaste your Client ID:
[oauth]
google_client_id = "123456789-abcdefghijklmnop.apps.googleusercontent.com"
Save the file
Restart the server:
invoke quickstart
Option B: Using Environment Variableď
Set the environment variable before starting the server:
export GOOGLE_CLIENT_ID="123456789-abcdefghijklmnop.apps.googleusercontent.com"
invoke quickstart
Or add to your .env file:
GOOGLE_CLIENT_ID=123456789-abcdefghijklmnop.apps.googleusercontent.com
Note: Environment variables take precedence over ppserver.toml (as of v0.5.1).
Step 5: Verify Configurationď
Check that the server is running:
curl http://localhost:8000/api/oauth/config
Expected response:
{
"google_client_id": "123456789-abcdefghijklmnop.apps.googleusercontent.com",
"google_enabled": true
}
If you see
"google_client_id": ""or"google_enabled": false, the configuration didnât load correctly. Check:ppserver.toml has correct format
Environment variable is set (if using that method)
Server was restarted after configuration
Step 6: Test Google Sign-Inď
Using Electron Clientď
Launch the Electron client:
invoke gui-electron
You should see:
Login form with username/password fields
OR separator with horizontal lines
Blue Sign in with Google button
Click Sign in with Google:
Google popup appears
Select your Google account
Authorize the app (first time only)
You should be logged in automatically
Using Web Browserď
Open your browser to
http://localhost:8000/docsFind the
POST /api/auth/googleendpointClick Try it out
Youâll need a Google ID token (get from a test client)
Troubleshootingď
âInvalid ID Tokenâ Errorď
Causes:
Client ID mismatch (frontend vs backend)
Authorized origins not configured in Google Console
Token expired or malformed
Solutions:
Verify Client ID in ppserver.toml matches Google Console
Check Authorized JavaScript origins includes
http://localhost:8000Try signing in again (tokens expire after 1 hour)
âPopup Blockedâ Errorď
For Electron:
Should not happen (Electron allows popups by default)
Check DevTools console for Google library loading errors
For Web Browser:
Check browser popup blocker settings
Allow popups for localhost:8000
âOAuth Not Configuredâ Server Errorď
Check ppserver.toml:
cat ppserver.toml | grep -A 2 "\[oauth\]"
Should show:
[oauth]
google_client_id = "YOUR_CLIENT_ID"
Not empty string "".
Check environment variables:
echo $GOOGLE_CLIENT_ID
Should print your Client ID, not empty.
Restart server:
invoke quickstart
Security Notesď
ID Token Flow: This implementation uses Googleâs ID token flow, which is secure for public clients (Electron apps)
No Client Secret: You donât need a client secret for ID token verification
Server-Side Verification: The server verifies the token with Googleâs servers before issuing a JWT
Token Storage: JWT tokens are stored in Electronâs localStorage (standard practice)
HTTPS in Production: Always use HTTPS in production environments
Testing Guideď
See GOOGLE_SIGNIN_TESTING.md for comprehensive testing instructions.
API Endpointsď
Get OAuth Configurationď
GET /api/oauth/config
Response:
{
"google_client_id": "string",
"google_enabled": true
}
Google Sign-In Authenticationď
POST /api/auth/google
Content-Type: application/json
{
"id_token": "string"
}
Response:
{
"access_token": "string",
"token_type": "bearer"
}
Additional Resourcesď
Need Help?ď
If you encounter issues:
Check the troubleshooting section above
Review server logs for error messages
Open DevTools console for frontend errors
Verify Google Cloud Console configuration
Ensure youâre using PutPlace v0.5.1 or later