Skip to content

Google sign-in for Search Console and Analytics

To let people connect Google Search Console or Google Analytics (GA4), your NulSEO server needs its own Google OAuth client. You create it once in Google Cloud. It takes about ten minutes.

This is optional. NulSEO works without it, just without Google's own data. Google data costs nothing: it comes from your Google account, not a paid provider.

1. Create a Google Cloud project and enable the APIs#

  1. Open the Google Cloud Console and create a project, or pick an existing one.
  2. Enable these APIs for the project:

You can skip the Analytics APIs if you only want Search Console, or the other way round.

Under APIs & Services → OAuth consent screen (called Google Auth Platform in newer consoles):

  1. Choose External, unless everyone who will connect is in your own Google Workspace organisation (then choose Internal).
  2. Fill in the app name (for example "NulSEO"), a support email and a developer contact email.
  3. While the app is in Testing, add every Google account that will connect as a test user. Otherwise Google blocks the sign-in with access_denied.
  4. Once a test user can connect, click Publish app to move it to In production.

Publishing matters. Google expires the connection for External apps in Testing after 7 days, so Search Console and Analytics would disconnect every week.

You do not need Google's verification for personal or internal use. During sign-in Google shows an "unverified app" warning, which you can click through.

3. Create the OAuth client#

Under APIs & Services → Credentials → Create credentials → OAuth client ID:

  1. Application type: Web application.

  2. Add both Authorised redirect URIs:

    https://nulseo.com/api/gsc/oauth/callback
    https://nulseo.com/api/ga4/oauth/callback

    The scheme, host and path must match exactly, with no trailing slash. If you use a custom domain, use that domain here.

  3. Save, then copy the Client ID and Client secret.

4. Add the client to NulSEO#

Put both values in .env.selfhost and deploy:

GOOGLE_CLIENT_ID=1234567890-abc.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-...
pnpm deploy:selfhost --yes

You can also add them as secrets on the Worker under Settings → Variables & Secrets in the Cloudflare dashboard.

With password accounts (the default), the deploy already generates the secret used to encrypt Google tokens, so you do not need to set anything else.

5. Connect#

In a project, open Project settings → Integrations and click Connect for Search Console or Analytics. Sign in with the Google account that has access to the site, then choose the property. See Google Search Console and Google Analytics.

How the connection is stored#

  • NulSEO stores the Google access and refresh tokens encrypted in its database.
  • Access is read-only. NulSEO never changes anything in your Google account.
  • Tokens are refreshed automatically, so once the app is published you only connect once.
  • Search Console and Analytics are separate connections. Disconnecting one leaves the other in place.

Troubleshooting#

redirect_uri_mismatch. The redirect URI in Google Cloud must exactly equal https://nulseo.com/api/gsc/oauth/callback (or /api/ga4/oauth/callback for Analytics). Check https, the host name, and that there is no trailing slash.

"Google OAuth client not configured". GOOGLE_CLIENT_ID or GOOGLE_CLIENT_SECRET is missing on the server. Set both and deploy again. https://nulseo.com/api/health shows which is missing.

access_denied while signing in. The Google account is not a test user and the app is still in Testing. Add it as a test user, or publish the app.

It disconnects every week. The app is still in Testing. Publish it, then reconnect once.

"Search Console API isn't enabled" or no Analytics properties appear. Enable the API in the same Google Cloud project as the OAuth client, wait a minute, and try again.

Connected, but no properties to choose. The Google account you signed in with has no access to a verified Search Console property or a GA4 property. Get access first, then reconnect.