Skip to main content
This guide explains how to configure Google as an OAuth 2.0 provider for SnackBase.

Prerequisites

  • A Google Cloud Platform (GCP) project
  • SnackBase installed and running
  1. Go to the Google Cloud Console
  2. Navigate to APIs & Services > OAuth consent screen
  3. Select User Type (Internal or External) and click Create
  4. Fill in the required application information (Name, User support email, etc.)
  5. Add scopes: .../auth/userinfo.email, .../auth/userinfo.profile, openid
  6. Add test users (if External and in Testing mode)

Step 2: Create Credentials

  1. Navigate to APIs & Services > Credentials
  2. Click Create Credentials > OAuth client ID
  3. Select Web application
  4. Name: Enter “SnackBase”
  5. 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

Step 3: Configure SnackBase

Copy the Client ID and Client Secret from the Google Cloud Console. In SnackBase, configure the Google provider:
FieldValue
client_idYour Google Client ID
client_secretYour Google Client Secret
redirect_uriThe Redirect URI you added in Step 2
scopesopenid email profile (default)

Testing

  1. Save your configuration
  2. 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.
Common Issues:
  • 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