<!-- source: https://docs.dreamlake.ai/account-center @ 0.1.192 b2f973b1 -->
# Account center (unreleased)

This implementation uses the independent Vuer account center. DreamLake Settings
provides an entry under **Email & login methods**; name, avatar, bio and personal
namespace handle remain local DreamLake profile settings.

The account center checks its first-party session against the subject supplied
by DreamLake's server. A mismatch requires switching accounts or leaving that
context. Primary email and GitHub/Google management happen at Vuer, including
recent reauthentication, new-address verification and existing-account conflicts.
No account merge is performed. Ordinary sign-in's existing same-email automatic
linking policy is unchanged.

## Server configuration and synchronization

Configure `VUER_ACCOUNT_ORIGIN` (origin only), `VUER_ACCOUNT_CLIENT_ID` and
`VUER_ACCOUNT_SECRET` (at least 32 random characters). Register the same client
and secret in Vuer's `ACCOUNT_INTEGRATIONS`, with an exact app return URL of
`https://<app-origin>/settings/account-return` and sync URL of
`https://<api-origin>/auth/identity-sync`. During the reviewed initial rollout, run
`pnpm exec tsx scripts/reconcile-account-identities.ts --apply` from
`dreamlake-server` against the explicitly selected database before enabling the
entry. This enrolls existing subjects for durable delivery and repairs their
replicas; it is safe to rerun after an interruption. This task did not run it
against production. Never expose the shared secret to the
browser. Production requires HTTPS. The account center also requires its
reviewed schema, dedicated provider callback registrations, mail gateway and
persistent delivery worker before release; see the owning Vuer docs.

- `POST /auth/account-center` requires a normal DreamLake user token and a random
  browser-bound `state`. The server obtains an opaque context from Vuer using
  the current user's stored `sub`; it accepts no client-supplied subject or return URL.
- The returning browser validates the stored state, expiry and DreamLake user ID,
  then calls `POST /auth/account-center/refresh`. The server reads authoritative
  identity by `sub`. Failed refreshes show a syncing state and retry.
- `POST /auth/identity-sync` accepts only the configured integration secret.
  The atomic update accepts a higher `identityVersion`, or a legacy unversioned
  row, and changes only email, verification status and version. Older/duplicate
  snapshots are acknowledged without overwriting the latest copy.
- Vuer's durable delivery survives a closed page or verification on another
  device. DreamLake's next token exchange also reads the authoritative identity
  to repair a missed delivery. If that read fails, stale email claims cannot
  automatically accept pending mailbox invitations on that exchange.

Changing email does not change user ID, `sub`, namespace ID/slug, resource
ownership or organization membership. This integration does not implement
enterprise SSO, employee deactivation propagation, alternate emails or self-service
account merges. Existing application JWTs are not globally revoked by a primary
email change; email claims must not be treated as the latest account profile.

## People search

Ordinary person searches require authentication. Name and personal namespace
slug use case-insensitive substring matching. A leading `@` searches only the
personal slug. An email-shaped input uses normalized exact equality (trim and
lowercase, preserving dots and `+tag`); fragments and domains do not search email.
Empty global searches do not enumerate users. Organization searches retain their
membership scope. Ordinary person-search responses omit email even on an exact
email hit. Organization member lists retain their existing email visibility,
with the same exact-email local filtering contract.
