Skip to content

fix(react): make the web binding cookie transport only - #193

Merged
Bccorb merged 1 commit into
mainfrom
fix/web-binding-cookie-only
Oct 19, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/web-binding-cookie-only

Conversation

@Bccorb

@Bccorb Bccorb commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Closes #178. Part of the v0.19 release (fells-code/seamless-auth-api#385).

Why

The browser bindings are meant to be cookie transport only: the server adapter keeps the tokens and the browser holds only httpOnly cookies. Angular and Vue already enforce it; @seamless-auth/react still accepted transport: { mode: 'bearer', tokenStorage }, which puts the access and refresh tokens in page script, where an XSS can read them instead of only riding the session.

The issue's open questions

  • Any first-party bearer use from @seamless-auth/react? None. Searched main of seamless-templates, seamless-auth-admin-dashboard, roxtarget-api, roxtarget-mobile, roxtarget-web and seamless-auth-docs for mode: 'bearer': only this package's README and tests
  • A non-browser React use that needs it? @seamless-auth/react-native has its own provider and does not import @seamless-auth/react, so native bearer is unaffected. Nothing else found

What

  • AuthProvider's transport type is Omit<TransportOptions, 'apiHost' | 'mode' | 'tokenStorage'>; it always builds cookie transport
  • A JavaScript caller passing mode: 'bearer' gets a TypeError naming @seamless-auth/react-native, rather than a silent switch to cookies
  • scripts/check-react-dist.mjs fails the build if the emitted React code configures bearer transport, like Angular's and Vue's checks
  • README section rewritten; tests updated, plus a refusal test
  • Breaking, so a minor changeset

Checks

  • npm run lint, npm run format:check, npm run typecheck: pass
  • npm test: 45 suites, 605 tests (Jest) and 41 (Vitest) pass
  • npm run build, npm run check-npm-build (including the new dist assertion): pass

AuthProvider's transport no longer accepts mode or tokenStorage, and
passing mode 'bearer' throws. Bearer transport stays with
@seamless-auth/react-native.

Closes #178
@Bccorb
Bccorb merged commit 9847d05 into main Oct 19, 2026
5 checks passed
@Bccorb
Bccorb deleted the fix/web-binding-cookie-only branch October 19, 2026 00:42
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.

fix(react): make the web binding cookie transport only

1 participant