Skip to content

docs: guide for shared sessions across subdomains - #150

Open
sea-snake wants to merge 1 commit into
feat/auth-configurable-storagefrom
feat/auth-shared-session-docs-v2
Open

docs: guide for shared sessions across subdomains#150
sea-snake wants to merge 1 commit into
feat/auth-configurable-storagefrom
feat/auth-shared-session-docs-v2

Conversation

@sea-snake

@sea-snake sea-snake commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Stacked on #149 (configurable storage).

A guide explaining how to share one sign-in across sibling subdomains of a single domain:

  • derivationOrigin for a shared principal, plus CookieDelegationStorage (via the new delegationStorage option) to share the sign-in state.
  • A silent prompt: 'none' acquisition on page load, using the hint cookie's announced principal (CookieDelegationStorage.readHint()) as hint.
  • Reacting to cross-tab and cross-subdomain session changes with AuthClient.subscribe, and releasing the listener with unsubscribe() / dispose().

Supersedes #147 (built on the old storage API — used the removed syncStorage option and KEY_STORAGE_DELEGATION).

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new documentation guide describing how to share a single Internet Identity session across sibling subdomains, using the new configurable delegation storage APIs introduced in #149, and wires it into the docs sidebar.

Changes:

  • New guide: shared sessions across subdomains (derivationOrigin + SyncCookieStorage + silent prompt: 'none' acquisition with hint).
  • Documents reacting to session changes via AuthClient.subscribe() and cleanup via unsubscribe() / dispose().
  • Adds the guide to the docs sidebar under a new “Guides” section.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
docs/src/content/docs/shared-sessions.md Adds an end-to-end guide for cross-subdomain shared sessions (configuration, sign-in/out, silent acquisition, subscriptions).
docs/src/content/docs/_sidebar.json Exposes the new guide in navigation under “Guides”.
Suppressed comments (2)

docs/src/content/docs/shared-sessions.md:61

  • With transport: 'redirect', signIn() must run on page load so the flow can replay and complete on the return redirect. The current example starts signIn() from a click handler, which means the return load may never re-run signIn() and the session won’t be established.
document.querySelector('#signin').onclick = () => {
  new AuthClient({ ...shared, prompt: 'login' }).signIn();
};

docs/src/content/docs/shared-sessions.md:97

  • This overpromises cross-subdomain propagation: SyncCookieStorage.subscribe() can notify immediately only via the Cookie Store API; otherwise it re-checks on visibilitychange/pageshow, so an always-visible tab may not update until it becomes visible again.
`AuthClient.subscribe` fires when the session changes elsewhere, so an open page
can update without a reload. A sign-out on any subdomain, or a sign-in in another
tab of the same origin, reaches every subscribed client.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/src/content/docs/shared-sessions.md Outdated
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch from 5a91ea0 to d740828 Compare August 14, 2026 14:24
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch from d740828 to baf266c Compare August 14, 2026 15:02
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch 10 times, most recently from ba0ce1c to eaef984 Compare August 17, 2026 09:03
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch 6 times, most recently from 76c0c54 to 6cb85e9 Compare August 17, 2026 10:07
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch from 6cb85e9 to bda2a17 Compare August 17, 2026 10:17
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch 2 times, most recently from e367acb to f282199 Compare August 17, 2026 10:40
Explains sharing one sign-in across sibling subdomains via SyncCookieStorage +
a silent prompt: 'none' acquisition on page load, and reacting to cross-tab /
cross-subdomain session changes with AuthClient.subscribe.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sea-snake
sea-snake force-pushed the feat/auth-shared-session-docs-v2 branch from f282199 to 5aa78d5 Compare August 17, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants