internet-identity-shared-sessions
Internet Identity Shared Sessions
Prerequisite
Load the internet-identity skill first and settle "Your app's identity is its primary origin". Everything here assumes one elected primary origin whose ii-alternative-origins already authorizes every sibling.
That is not a courtesy link. Subdomains share a sign-in only when they share a principal, and a shared cookie does not produce one. Build this on top of separate principals and every app reads a record naming an account it can never hold, which is the /reauth loop in that skill's mistakes list.
What this gets you
chat.example.com and hr.example.com can share one sign-in: sign in on one and the others are signed in without a second visit to Internet Identity, and signing out on one signs the user out on all of them.
Principals are per origin, so every app must derive from one primary origin, listed in that origin's /.well-known/ii-alternative-origins. Without it each subdomain gets its own principal and there is nothing to share.
1. Share the record
Every app builds its client with the same derivation origin and the same cookie domain, so a sign-in on one writes a record the others read: