Google Service Account
Set up a Google Cloud service account to give PageBridge access to your Search Console data.
1. Create a Google Cloud project
If you don't already have one, create a project in the Google Cloud Console. Navigate to IAM & Admin > Service Accounts.
2. Enable the Search Console API
In the Google Cloud Console, go to APIs & Services > Library and search for "Google Search Console API". Click Enable.
Also enable the Web Search Indexing API if you want to use the index status checking feature.
3. Create a service account
Go to IAM & Admin > Service Accounts and click Create Service Account:
- Give it a descriptive name like
pagebridge-sync - No additional roles are needed at the project level
- Click Done
4. Create a JSON key
Click on the newly created service account, then:
- Go to the Keys tab
- Click Add Key > Create new key
- Select JSON format
- Download the file
The JSON file contains the credentials. You'll set the entire JSON content as the GOOGLE_SERVICE_ACCOUNT environment variable.
5. Grant Search Console access
The service account needs access to your Search Console properties. In Google Search Console:
- Go to your property settings
- Click Users and permissions
- Click Add user
- Enter the service account email (e.g.,
pagebridge-sync@my-project.iam.gserviceaccount.com) - Set permission to Full (required for URL Inspection API)
6. Set the environment variable
Stringify the JSON key file and set it as an environment variable:
# Inline the JSON (single line)
GOOGLE_SERVICE_ACCOUNT='{"type":"service_account","project_id":"my-project","private_key":"-----BEGIN PRIVATE KEY-----\n...","client_email":"pagebridge-sync@my-project.iam.gserviceaccount.com",...}'7. Verify access
Test that PageBridge can access your GSC properties:
pnpm pagebridge list-sitesYou should see your Search Console properties listed. If not, double-check that the service account email has been added to the property with Full permissions.
Troubleshooting
- No sites listed — The service account email hasn't been added to any GSC property. Add it with Full permissions.
- Authentication error — The
GOOGLE_SERVICE_ACCOUNTJSON may be malformed. Ensure it's a valid JSON string with escaped newlines in the private key. - API not enabled — Ensure the Search Console API is enabled in your Google Cloud project.