Theming the login screen

Client applications can brand the Ipseity pages they send their users to — the OAuth login form and the per-client consent screen — by appending a theme query parameter to the authorization request:

https://idp.example.com/oauth/authorize?
  response_type=code&
  client_id=my-app&
  redirect_uri=https://app.example.com/callback&
  scope=openid%20profile&
  code_challenge=…&code_challenge_method=S256&
  theme=https%3A%2F%2Fapp.example.com%2Ftheme.css

The theme value is the URL of a CSS stylesheet that is applied on top of Ipseity's default (dark) login styles. A simple light-mode example is included as example-theme.css.

The internal identity console (the SPA at /) is Ipseity's own UI and is not driven by client theme parameters; theming applies to the pages served to a client's end users during the OAuth flow (the login form and the consent screen).

Security model: the redirect-rule trust boundary

A theme stylesheet is only applied when the URL:

  1. uses an http:// or https:// scheme, and
  2. matches one of the OAuth client's redirect_uris rules.

Anything else — a non-http(s) URL, a URL on a host the client doesn't control, or a URL that matches no redirect rule — is silently ignored (the page is rendered with the default theme and no error is surfaced).

The rationale: the redirect_uris allowlist is the set of URLs the client is already trusted to send the user's browser to (where the authorization code is delivered). Requiring the theme to live under the same rules means the CSS comes from a host the client already controls, so a theme cannot be injected from an untrusted origin to spoof or tamper with the login page. CSS applied to a stylesheet cannot read typed form values, so this adds no meaningful exfiltration surface beyond what the client could already do at its redirect target.

The URL is HTML-escaped when embedded, so it cannot break out of the <link> attribute or inject markup.

Matching rules and the exact-redirect caveat

theme matches against the same rule formats as redirect_uri:

Rule format Example that matches https://app.example.com/theme.css
prefix wildcard https://app.example.com/.*
regex `re:https://app\.example\.com/(?:theme
global wildcard .* (matches everything; high risk, admin-managed)
exact https://app.example.com/theme.css (must be the exact URL)

Caveat: a client with an exact redirect_uris entry (for example https://app.example.com/callback) will reject a theme at a different path such as https://app.example.com/theme.css. Use a prefix-wildcard or re: rule that covers both the redirect URI and the theme URL, or point theme at the exact redirect URL.

How to use it

  1. Publish a CSS file at a URL that matches one of your client's redirect_uris rules (for example https://app.example.com/theme.css).
  2. When starting the OAuth flow, append &theme=<url-encoded-url> to the authorization request.
  3. The login form (and, when the client sets require_consent, the consent screen) is served with your stylesheet loaded after Ipseity's base styles.

The theme is also carried through an external-provider login, so a consented external login keeps the same theme.

Operation notes

  • The theme <link> is render-blocking: keep the stylesheet small and served from a fast CDN so it does not delay the login page. If the theme host is slow or unreachable, the page falls back to Ipseity's default styles (the base stylesheet is always loaded first).
  • Ipseity does not currently send a Content-Security-Policy on these pages; if a strict CSP is ever added, the theme origin will need to be allow-listed under style-src.

Themeable surface

Ipseity's login and consent pages are styled with CSS custom properties defined on :root in app/static/styles.css. The cleanest way to theme is to override those variables, then optionally restyle specific elements.

Base palette variables (override these for a full theme)

Variable Default (dark) Controls
--bg #071121 Page background base.
--bg-alt #0b1d35 Page background variation.
--panel #102845 Card/panel background.
--panel-soft #17365a Softer panel accents.
--line #2a4d76 Borders and separators.
--text #d7e8ff Primary text colour.
--muted #9eb9d9 Secondary/helper text.
--accent #2e7fe8 Primary accent (buttons).
--accent-soft #4a99ff Accent highlight.
--error #ff7f7f Error text.

Classes

Selector What it styles
body Overall page background (a radial gradient over the palette).
.screen.login-screen The full-height flex wrapper around the card.
.login-card The login/consent card container (width and layout).
.panel Shared card surface (background, border, radius, padding).
.login-title The heading (the client's display name on the login page / "Authorize Application" on consent).
.login-subtitle The subtitle line under the heading.
.muted Muted/helper text.
.form-column The form's vertical layout and label spacing.
label Form field labels.
input, select, textarea Form fields (background, border, text).
.button General buttons.
.button-primary The primary "Sign In" / "Approve" button.
.inline-links The horizontal button row on the consent page.
.info-icon The "i" help icon next to fields.

IDs

ID Page What it is
username Login form The username field.
password Login form The password field.
mfa_code Login form The optional TOTP/MFA code field.
consent_token Consent form Hidden token identifying the pending consent request.

Example

See example-theme.css for a complete light-mode theme. To use it, publish it (or a variant) at a URL matching your client's redirect_uris, then pass &theme=<that url>.

/* excerpt from example-theme.css — override the palette, keep the structure */
:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #1c2b3a;
  --muted: #5b6b7f;
  --accent: #1d6fd1;
  --accent-soft: #3a8bef;
  --line: #c9d6e5;
  --error: #c62828;
}