Sign-in providers
This page helps you turn GitHub and Google sign-in on or off in an environment, and rotate their client secrets.
GitHub and Google are optional ways to sign up and sign in. Each environment enables them with OAuth apps of its own, so a staging secret never signs anyone in to production. Previews have none: a provider only redirects back to the callback URLs registered with it, and a preview’s host is new each time. To add another provider, see adding a federation provider.
Enable a provider
-
Register an OAuth app for the environment, with its callback URL.
- GitHub: an OAuth app, not a GitHub App, of the
sourceorigin-devorganization, under Settings > Developer settings > OAuth Apps. Its homepage is the environment’s web origin. Generate a client secret. - Google: in a Google Cloud project, configure the Google Auth Platform:
branding, audience External, and data access
openid,emailandprofile. Then add an OAuth client of type Web application, with the callback URL as its only authorized redirect URI. Branding links tohttps://sourceorigin.dev,https://sourceorigin.dev/privacyandhttps://sourceorigin.dev/terms, on the authorized domainsourceorigin.dev, verified in Search Console. Until the app is published, only its test users can sign in. These scopes need no verification to publish.
- GitHub: an OAuth app, not a GitHub App, of the
-
Store the client secret, mountable by that environment only:
piquelctl app secret sourceorigin set github-production --stdin --environments production --no-previews -
In
infra/piqueld.toml, set the environment’s client ID variable,github_client_idorgoogle_client_id, and itsgithub_secretorgoogle_secretto the stored secret’s name. -
Merge the change. Staging uses it from the deployment that follows, and production from its next promotion.
-
Check that the environment’s sign-in page offers GitHub or Google under “or continue with”, and that it signs in.
Rotate a client secret
-
Create a second client secret with the provider, keeping the old one.
-
Store it under the same name, with the same access:
piquelctl app secret sourceorigin set github-production --stdin --environments production --no-previews -
Deploy the environment:
piquelctl --timeout 30m env deploy sourceorigin stagingfor staging, or production’s own release again for production. Auth reads and checks the secret at startup only. -
Sign in with the provider on the environment, to check the new secret works.
-
Delete the old secret with the provider.
Turn a provider off
- In
infra/piqueld.toml, remove the environment’s client ID variable, or set it to"", and set its secret variable back tono-provider-secret. - Merge the change, and promote it to production if it’s production’s.
Auth then ignores the provider’s secret, and its sign-in pages no longer offer the provider.
Environments
| Environment | Callback URLs | Client ID variables | Stored secrets |
|---|---|---|---|
| production | https://auth.sourceorigin.dev/login/github/callback, https://auth.sourceorigin.dev/login/google/callback | github_client_id, google_client_id | github-production, google-production |
| staging | https://auth.staging.sourceorigin.dev/login/github/callback, https://auth.staging.sourceorigin.dev/login/google/callback | github_client_id, google_client_id | github-staging, google-staging |
An empty client ID variable, the default, turns a provider off. The manifest
then mounts the generated no-provider-secret in its place, which auth never
reads.
GitHub asks for read:user user:email, and Google for openid email profile.
Never put a provider’s secret, or a confidential client’s, in frontend
configuration.