# Google and Microsoft console login

**Last updated:** 2026-11-13T20:33:20-03:00 (UTC-3)

Use [named OIDC providers](/docs/features/oidc-providers/) to offer Google and Microsoft Entra ID beside other corporate login buttons. They reuse the gateway's server-side authorization-code flow, PKCE S256, state, nonce, signed ID-token validation and current local-user authority. No provider password or token is returned to the console.

**Qualified profile:** real Google Web OAuth and Microsoft Entra organizational-tenant Web application logins were verified through the compiled gateway, PostgreSQL and the owner's Chrome on macOS. Each created its own expected viewer session; independent validation checked the current provider/generation, user and role, per-vendor flag isolation, CSRF and correlated request/trace metadata. The Microsoft run exercised the existing past clock-skew allowance. This does not certify Microsoft common/consumer/B2C/sovereign authorities, every tenant policy, or the final complete release. An enabled flag, configured secret or available button alone is not evidence of a valid login.

## Defaults and operational controls

| Setting | Default | Effect |
| --- | --- | --- |
| `features.oidc_providers` | `false` | Parent switch for all named login profiles |
| `features.google_oidc_login` | `true` | Admit official Google **named** profiles while the parent is enabled |
| `features.microsoft_oidc_login` | `true` | Admit official single-tenant Microsoft **named** profiles while the parent is enabled |
| `features.oidc_provider_management` | `false` | Allow current global administrators to manage declared profiles' access policies |

The vendor switches are standby capabilities: their default does not configure a client or expose a login on its own. Use the existing **Settings & sources → Features** controls or versioned feature API for runtime changes, or set the same booleans in YAML. Edition-manifest defaults remain configurable at build time. False hides and denies the matching named login, rejects callbacks and invalidates that vendor's named sessions. Restoring it permits new sign-ins; it does not revive old sessions. Other named providers keep their sessions. A policy can still be reviewed while its vendor switch is off.

These switches do not control the separate legacy `admin.oidc` singleton. Migrate that trust to a named entry if vendor-specific admission is required; never assume that turning off a named switch disables every legacy federation path. Flags do not grant roles, memberships or permission to manage federation.

Named session admission uses the existing atomic PostgreSQL timestamp fence: an issued-at value no older than five minutes plus 30 seconds of skew and no more than 30 seconds in the future. The gateway applies the same precheck; it does not replace signature/nonce, the five-minute browser flow, current identity/generation checks or logout tombstones. Microsoft can backdate the issued-at claim: the verified real session used this allowance. Keep machine/database time synchronized; increasing a proxy timeout does not repair a stale or invalid assertion. These protocol checks are distinct from the local session's lifetime and an operator's client-secret expiry policy.

## Google Web OAuth client

1. In [Google Cloud credentials](https://console.cloud.google.com/apis/credentials), configure consent/branding and create a **Web application** OAuth client. An external application in testing needs an allowed test account.
2. Register the exact named callback, for example `https://gateway.example.com/api/v1/admin/auth/oidc/google/callback`. Scheme, host, port, path and trailing slash matter. This server-side flow needs no browser JavaScript origin.
3. Put the client secret in an operator-owned environment/Secret reference. Keep the secret out of YAML values, API examples, logs and screenshots.
4. Declare the disabled profile below, create the intended local user, then add its explicit immutable Google `sub` link and enable the profile through the named policy editor/API or reviewed YAML.

```yaml
features:
  ui: true
  console_users: true
  oidc_login: true
  oidc_providers: true
  oidc_provider_management: true
  google_oidc_login: true
admin:
  oidc_providers:
    - id: google
      label: Continue with Google
      disabled: true
      issuer_url: https://accounts.google.com
      client_id: YOUR_GOOGLE_WEB_CLIENT_ID
      client_secret_env: GATEWAY_GOOGLE_OIDC_SECRET
      redirect_url: https://gateway.example.com/api/v1/admin/auth/oidc/google/callback
      allowed_endpoint_origins:
        - https://oauth2.googleapis.com
        - https://www.googleapis.com
      allow_loopback_http: false
      session_epoch: google-v1
      subject_users: {}
      group_policy: null
```

The issuer is configured exactly as shown. Its origin is implicit; the token and JWKS origins must be explicitly admitted. Other origins, wildcard hosts and noncanonical spellings are refused for an active official profile. Discovery and backend requests do not follow redirects.

Google documents two possible ID-token issuer values: `https://accounts.google.com` and `accounts.google.com`. Only this named official Google profile accepts the bare alias, after cryptographic verification. It keeps one canonical private issuer/session namespace. This does not relax issuer checking for another provider or the legacy singleton. See [Google's OIDC contract](https://developers.google.com/identity/openid-connect/openid-connect).

The gateway requests only `openid`; it does not request profile, email, offline access or call userinfo. Email, hosted-domain hints and display names never replace `sub`. Standard Google ID tokens do not provide this gateway's configurable group restriction; use a broker that supplies the required signed group claim when that restriction is needed. A global group policy cannot be bypassed by this profile. Google RISC and provider-wide logout are separate protocols, not implied by OIDC login or the gateway's generic logout routes.

## Microsoft Entra Web application

1. In [Microsoft Entra app registrations](https://entra.microsoft.com/), create an application for **accounts in this organizational directory only**. Use the public-cloud tenant's immutable lowercase GUID.
2. Add the **Web** platform and register the exact callback, such as `https://gateway.example.com/api/v1/admin/auth/oidc/microsoft/callback`. Keep implicit access/ID-token grants and public-client fallback disabled; this is a confidential authorization-code flow.
3. Create a client secret with the lifetime your operator chooses and store its value in the referenced Secret. No Microsoft Graph application/delegated permissions are required by this gateway's `openid` login. An organization's consent/assignment policies may still require its administrator.
4. Stage the profile below; replace the example tenant/client with your real application, then explicitly link its verified `sub` to an existing local user before enabling it.

```yaml
features:
  microsoft_oidc_login: true
admin:
  oidc_providers:
    - id: microsoft
      label: Continue with Microsoft
      disabled: true
      issuer_url: https://login.microsoftonline.com/11111111-2222-3333-4444-555555555555/v2.0
      client_id: YOUR_ENTRA_APPLICATION_CLIENT_ID
      client_secret_env: GATEWAY_MICROSOFT_OIDC_SECRET
      redirect_url: https://gateway.example.com/api/v1/admin/auth/oidc/microsoft/callback
      allowed_endpoint_origins: []
      allow_loopback_http: false
      session_epoch: microsoft-v1
      subject_users: {}
      group_policy: null
```

Combine entries in the same `admin.oidc_providers` list and retain the parent flags from the Google example. Each ID determines its own callback. Adding a boot entry/issuer/client/secret reference requires a coordinated restart and reviewed baseline adoption; the API/console does not create external applications or silently expand network trust.

The active issuer must be exactly `https://login.microsoftonline.com/<tenant-guid>/v2.0`. The verified ID token's `tid` must match that tenant, in addition to signature, issuer, sole audience, authorized party when present and nonce checks. There is no `common`, `organizations`, `consumers`, tenant-domain alias, B2C or sovereign-cloud fallback in this profile. The consumer-account tenant is excluded; a permitted guest authenticates in the configured organizational tenant. Several explicitly configured tenant profiles form a bounded allowlist; they do not turn `common` into an unrestricted issuer.

Microsoft `sub` is application-specific. Neither Graph `oid`, an email nor a username is a substitute. Signed groups may restrict an existing user's sign-in when the application emits the configured claim. Missing/overage group claims cannot be replaced by a Graph lookup or used to grant a local role. See [Microsoft's ID-token claims](https://learn.microsoft.com/en-us/entra/identity-platform/id-token-claims-reference) and [authorization-code flow](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow).

## Explicit identity links, testing and recovery

Obtain `sub` from a trusted, cryptographically verified identity assertion or the corresponding trusted existing IdP link. Do not decode an unverified token and treat it as identity, paste tokens into third-party decoders, or configure a placeholder email/ID. Google/Microsoft API keys used for model inference are unrelated to Web OAuth client credentials. Until the exact subject is linked to an active local user, the named callback grants no console session and creates no user automatically.

For an isolated local test, use the exact callbacks `http://localhost:8845/api/v1/admin/auth/oidc/google/callback` and `http://localhost:8845/api/v1/admin/auth/oidc/microsoft/callback`, with a free owned port, `admin.allow_insecure_http: true` and that profile's `allow_loopback_http: true`. Register the same URLs at the IdP. Production keeps HTTPS; a private-network hostname is not a loopback exception. An operator supplies the OAuth clients, account consent and PostgreSQL; selecting this configuration does not provision them.

Use a dedicated temporary OAuth client where possible. When deliberately adding a test redirect to an existing client, preserve every existing URI and secret; remove only the added URI afterwards. Delete only test-owned applications/secrets. Actual account login is performed by the account owner. Test successful login and denied identity, flag off/on without session resurrection, another provider's isolation and current local-user revocation. Record real-vendor proof separately from deterministic fixtures.

The console's **Console users → Named OIDC providers** review shows the exact callback, `openid` scope, tenant where applicable and the effective named-vendor switch. These are configuration facts, not health indicators. Immutable trust stays read-only/restart-required; the existing five-field policy replacement, source, CAS/version/base adoption, audit, secret handling, correlation and failure semantics remain in the [named-provider contract](/docs/features/oidc-providers/). Keep a separate authorized recovery login before changing any federation policy.

## Failed sign-in and diagnostics

A failed attempt does not revoke a valid earlier session: an unauthenticated request must not be able to sign someone else out. The console instead shows **“Sign-in failed; current session unchanged.”** when the failed-login response returns to an authenticated console. The notice survives navigation within that mounted console until explicit dismissal or a successful sign-in/new document; it is not stored across hard reloads. The prior user's role and permissions remain in force. Opening `/ui` alone therefore never proves that a requested new identity succeeded.

Named callback failures emit the contextual `oidc_login_failed` event with finite `stage` and `cause`. Token exchange retains only the sanitized status/allowlisted OAuth code. `session_record` with `record_iat_too_old` or `record_iat_future` distinguishes the issuance fence from a signature, nonce, identity or current-authority failure. Raw claims, timestamps, subjects, callback URLs, tokens, codes and provider error bodies are not diagnostic payloads. Use request/trace correlation with the existing [log conventions](/docs/features/observability/); do not paste OAuth callback URLs into support reports.

`/ui` and `/ui/` are supported aliases of the same renderer and CSP; both use the same `#/analytics` fragment. A trailing slash is unrelated to the selected identity or its permissions. For qualification, inspect the actual current provider/user session and authorization result, rather than relying on an open analytics page.
