Prerequisites
- A Google Cloud Platform (GCP) project
- SnackBase installed and running
Step 1: Configure OAuth Consent Screen
- Go to the Google Cloud Console
- Navigate to APIs & Services > OAuth consent screen
- Select User Type (Internal or External) and click Create
- Fill in the required application information (Name, User support email, etc.)
- Add scopes:
.../auth/userinfo.email,.../auth/userinfo.profile,openid - Add test users (if External and in Testing mode)
Step 2: Create Credentials
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Select Web application
- Name: Enter “SnackBase”
- Authorized redirect URIs: Add your SnackBase callback URL
- Format:
https://<your-domain>/api/v1/auth/oauth/google/callback - For local development:
http://localhost:8000/api/v1/auth/oauth/google/callback
- Format:
Step 3: Configure SnackBase
Copy the Client ID and Client Secret from the Google Cloud Console. In SnackBase, configure the Google provider:| Field | Value |
|---|---|
client_id | Your Google Client ID |
client_secret | Your Google Client Secret |
redirect_uri | The Redirect URI you added in Step 2 |
scopes | openid email profile (default) |
Testing
- Save your configuration
- Attempt to sign in via the Google button on the login page
Troubleshooting
Make sure your redirect URI exactly matches what you configured in Google Cloud Console, including the protocol (http/https) and port.
- redirect_uri_mismatch: Ensure the redirect URI in Google Cloud Console matches exactly
- access_denied: User declined the authorization request
- invalid_client: Check that your client ID and secret are correct
Related Guides
- OAuth Overview - Understanding the OAuth flow
- GitHub OAuth Setup
- Microsoft OAuth Setup