Google Search Console authentication and OAuth setup guide #
This guide walks through configuring Google Cloud Application Default Credentials (ADC) or OAuth 2.0 credentials to authorize Search Console ingestion into SQLite.
1. Prerequisites #
- Google Account: An account with verified ownership or read permissions on at least one property in Google Search Console .
- Google Cloud Project: A project in Google Cloud Console .
2. Quick authentication via Application Default Credentials (ADC) #
Read-only sync (sync) requests only https://www.googleapis.com/auth/webmasters.readonly:
bash
gcloud auth application-default login \
--scopes https://www.googleapis.com/auth/webmasters.readonly,https://www.googleapis.com/auth/cloud-platformIf you also submit XML sitemaps (submit-sitemap), include https://www.googleapis.com/auth/webmasters in your scopes, or use the desktop/web OAuth flow below.
3. Step-by-step GCP and OAuth configuration #
Step 1: Enable the Google Search Console API #
- Open the Google Cloud Console API Library .
- Search for Google Search Console API (formerly Webmasters API).
- Click Enable.
Step 2: Configure the OAuth consent screen #
- Go to APIs & Services > OAuth consent screen.
- Select User Type:
- External (standard for personal Gmail or Google Workspace accounts).
- Internal (if restricted to your Google Workspace organization).
- Fill in basic app info:
- App name:
Search Analytics Local App - User support email: Your email address
- Developer contact: Your email address
- App name:
- Click Save and Continue.
- On the Scopes page, click Add or Remove Scopes and add:
https://www.googleapis.com/auth/webmasters.readonly(Read-only access to sites, sitemaps, and search analytics)https://www.googleapis.com/auth/webmasters(Required for submitting XML sitemaps viasubmit-sitemap)
- On the Test users page, click + Add Users and enter your Google account email address.
- Save and finish.
Step 3: Create OAuth 2.0 client ID credentials #
- Go to APIs & Services > Credentials.
- Click + Create Credentials > OAuth client ID.
- Select Application type: Desktop app (or Web application with redirect URIs
http://localhost:8080/oauth2callbackandhttp://127.0.0.1:8080/oauth2callback). - Set Name:
Search Analytics Local App. - Click Create and download the client secret JSON file.
Step 4: Save client secret #
Copy the downloaded file to your local configuration folder:
bash
mkdir -p ~/.config/gsc
cp ~/Downloads/client_secret_*.json ~/.config/gsc/client_secret.json4. Authorization flow and token management #
Once the client secret is placed at ~/.config/gsc/client_secret.json, run the authorization flow:
bash
uv run scripts/search_analytics.py auth --port 8080- If using a Web application client secret, open
http://localhost:8080in your browser and click Authorize with Google (Desktop app secrets launch the local callback automatically). - Select your Google account and grant the requested permissions.
- The CLI exchanges the authorization code for an access token and refresh token, persisting them to
~/.config/gsc/credentials.jsonand refreshing automatically on later runs.
