Digital Sovereignty for everyone

Single sign-on

Signing in once logs a member in across every site on the network. The main site holds the session; subsites borrow it rather than creating sessions of their own.

How it works

  • Logged-out visit to a subsite. A script sends the browser to the main site with lh_membership-sso_return. If the browser has a main-site session, the main site issues a short-lived signed token carrying the user ID, that session’s token and the return URL, and redirects back.
  • Callback on the subsite. The subsite checks the token’s HMAC signature and expiry, confirms the session token is still valid with WP_Session_Tokens::verify(), and sets its own auth cookies on that same session. It then fires wp_login once, so login actions such as role upgrades and audit logging run.
  • Login on a subsite. A normal login on a subsite is synced the other way: the login redirect is routed through the main site with a token, so the main site gets the session too.

All three endpoints run on template_redirect, so cookies are set in a normal request. The token lifetime defaults to 60 seconds, filterable with lh_membership_sso_token_ttl.

When the logged-out check runs

The script (assets/scripts/lh-membership-sso-loggedout.js) sends the visitor to the main site at most once per browser tab, and only when they arrive from outside the network (no referrer, or a referrer that is not a network domain). It does nothing on the login, recovery and registration pages.

  • Automation is skipped: browsers reporting navigator.webdriver, and user agents matching the skip pattern (crawlers, headless browsers, Lighthouse by name).
  • Prerendered pages wait. A page prerendered by speculation rules (for example LH Jumpstart) does not redirect while hidden. The check runs when the visitor actually opens the page, so a prerender never triggers the redirect or uses up the tab’s one attempt. (Since 2.109.1.)
  • Known cost: a logged-out visitor arriving from outside the network loads the page twice, because the main site sends them straight back. PageSpeed Insights reports this as a redirect. This is accepted in exchange for signing in network members automatically.

The same script rewrites links to other network domains to go through the main site, so members following them arrive signed in.

Two Factor

When the Two Factor plugin is active, its wp_login handler is removed while the SSO callback fires wp_login, then restored. The session being transferred was created on the main site and has already passed any second factor there, so the subsite does not challenge again. Every real login, on any site, is still challenged as usual. (Since 2.91.6.)

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.