Skip to main content

Brand the hosted pages

Give the hosted sign-in and account pages your logo, colours and theme, for the organization or for one application.

RecipeReadyView source
Packages
lumo
Works with
lumo CLI

What it shows​

  1. The organization gets a logo, a button colour, a light theme and a title of its own. A change through the API is published at once.
  2. The sign-in pages offer nine languages. Arabic pages read from right to left.
  3. One application gets another colour, another title and a split layout, on top of the look of the organization.
  4. Custom CSS changes what the settings do not cover, here the corners of the form card.
  5. The script prints the stored values and the address of the sign-in page.

Before you start​

  • An application whose sign-in you can start, for example the Starter App of a new organization. The script reads its client ID.
  • For custom CSS, check that your plan includes custom CSS and HTML in the plans matrix. Without it, the script says that the CSS was refused and goes on.

The portal has the same settings. The organization's look is under Login page & emails, and each application has a Branding tab.

VariableValue
LUMOAUTH_URLThe address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region.
LUMOAUTH_ORG_IDYour organization, for example acme-corp.
LUMOAUTH_API_KEYAn API key with the scopes admin:settings:read, admin:settings:write, admin:clients:read and admin:clients:write. Its creator needs the permissions branding.edit and clients.edit.
LUMOAUTH_CLIENT_IDThe client ID of the application that gets its own look.

Code​

Run each command from the recipes folder of the examples repository. Set the folder up once for your language. Every version below was run against a LumoAuth organization. The script ran against an organization. A browser then opened the sign-in page of the organization and of the application, in English, Japanese and Arabic.

sign-in/branding/cli/branding.sh
#!/bin/sh
# Gives the hosted sign-in pages the look of Northwind Labs: for the whole
# organization, then a different look for one application.
#
# sh sign-in/branding/cli/branding.sh
#
# The script needs the lumo CLI and jq.
set -eu

# The CLI reads its own three variables. With them it needs no `lumo login`.
export LUMO_BASE_URL="$LUMOAUTH_URL" LUMO_ORG="$LUMOAUTH_ORG_ID" LUMO_API_KEY="$LUMOAUTH_API_KEY"

# 1. The organization: logo, button colour, a fixed light theme, a title and nine
# languages. A change through the API is published at once.
lumo settings update branding --data '{
"enabled": true,
"logo_url": "https://example.com/northwind/logo.svg",
"primary_color": "#0f766e",
"theme": "light",
"welcome_title": "Welcome to Northwind Labs",
"locales": ["en", "es", "fr", "de", "pt_BR", "it", "nl", "ja", "ar"],
"default_locale": "en"
}' > /dev/null

# 2. One application: another colour, another title and a split layout. Empty
# keys keep the values of the organization.
lumo api PATCH "/clients/$LUMOAUTH_CLIENT_ID/branding" --data '{
"login": {
"enabled": true,
"primary_color": "#7c3aed",
"welcome_title": "Welcome to Northwind Shop",
"layout": "split-right"
}
}' > /dev/null

# 3. Custom CSS for what the settings do not cover. LumoAuth filters it and
# keeps only the rules that it recognises. A plan without custom CSS refuses it.
lumo settings update branding --set custom_css='.lumo-card { border-radius: 20px; }' > /dev/null ||
echo "custom CSS was refused: check that your plan includes it"

lumo settings get branding -o json | jq -r '.data | "organization: \(.primary_color), theme \(.theme), \(.locales | length) languages, custom CSS: \(.custom_css)"'
lumo api GET "/clients/$LUMOAUTH_CLIENT_ID/branding" -o json | jq -r '.data.login | "application: \(.primary_color), layout \(.layout), \"\(.welcome_title)\""'
echo "sign-in page: $LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID/login"
sh sign-in/branding/cli/branding.sh

The script needs the lumo CLI and jq.

Check the result​

Output
organization: #0f766e, theme light, 9 languages, custom CSS: .lumo-card { border-radius: 20px; }
application: #7c3aed, layout split-right, "Welcome to Northwind Shop"
sign-in page: https://app.lumoauth.dev/orgs/acme-corp/login
  • Open the sign-in page in a private window. It shows the title "Welcome to Northwind Labs", a teal button and a card with round corners, in the light theme.
  • Start a sign-in from the application. The same page now shows "Welcome to Northwind Shop", a purple button and the split layout.
  • Add ui_locales=ar to the authorization request, or choose a language in the menu at the bottom of the page. In Arabic, the page reads from right to left and the texts of LumoAuth are translated.

Limits​

  • Your own texts, such as the welcome title, are shown as you typed them, in every language. To reword the texts of LumoAuth for one language, use texts, or Your wording in the portal.
  • Custom CSS passes a filter that keeps only the rules that it recognises. url(), @import and @font-face are removed, so use the logo and background fields for images.
  • An application cannot set the languages, your wording, the legal consents or the "Secured by LumoAuth" badge. These belong to the organization.
  • The logo is an address on the web. An image embedded as a data: address is refused.
  • Error pages keep the look of LumoAuth.