Skip to main content
HydroGo
SecurityOAuth2 2-minute setup

OAuth2 2-minute setup

Enable Google, GitHub, or Apple sign-in for staff and storefront members with two environment variables and live Admin toggling.

HydroGo ships PKCE + HMAC-signed state cookies and Apple JWKS verification directly in the core binary. Staff sign-in never creates accounts on the fly — it links only to existing, active admin or editor accounts with a matching verified email.

1. Set client credentials

In local development, only CLIENT_ID and CLIENT_SECRET are needed. HydroGo automatically derives the callback URL from http.public_origin (or http://127.0.0.1:8080) and generates an ephemeral state key:

export HYDRO_OAUTH_GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export HYDRO_OAUTH_GOOGLE_CLIENT_SECRET="your-client-secret"
# Optional override (auto-derived in dev or from http.public_origin):
# export HYDRO_OAUTH_GOOGLE_REDIRECT_URL="https://cms.example.com/auth/oauth/google/callback"

2. Production requirements

When HYDRO_ENV=production, set a persistent 32+ byte HYDRO_OAUTH_STATE_KEY and http.public_origin so state cookies remain valid across restarts and instances:

BASH
export HYDRO_OAUTH_STATE_KEY="$(openssl rand -hex 32)"
export HYDRO_PUBLIC_ORIGIN="https://cms.example.com"

3. Toggle providers live in Studio

Open Site → Auth & OAuth2 in the Admin Studio to inspect the exact Admin and Member callback URLs for Google, GitHub, and Apple, and enable or disable configured providers immediately without restarting the server.

When a provider is configured and enabled, the Admin sign-in screen automatically displays a Continue with {Provider} button.