Skip to content

WORKOS_COOKIE_DOMAIN env var ignored unless set via configure() #114

Description

@DrunkOldDog

Describe the bug
Setting WORKOS_COOKIE_DOMAIN has no effect in @workos/authkit-tanstack-react-start. The session cookie is written without a Domain attribute, so it can't be shared across subdomains. The equivalent env var works fine in @workos-inc/authkit-nextjs.

The only way to get the domain applied is to call configure({ cookieDomain: '...' }) from @workos/authkit-session manually before the service initializes.

To Reproduce
Steps to reproduce the behavior:

  1. Start from the official tanstack example: https://github.com/TanStack/router/tree/main/examples/react/start-workos
  2. Add WORKOS_COOKIE_DOMAIN=app.localhost (alongside the usual WORKOS_* vars) to .env.
  3. Sign in and inspect the Set-Cookie response header for the wos-session cookie (DevTools → Network, or Application → Cookies).
  4. The cookie is written with no Domain attribute, WORKOS_COOKIE_DOMAIN is ignored.

Expected behavior
WORKOS_COOKIE_DOMAIN should be read from the environment and applied as the Domain attribute of the session cookie, with parity to @workos-inc/authkit-nextjs, without needing a manual configure() call.

Desktop (please complete the following information):

  • OS: macOS Tahoe 26.5.1
  • Browser: chrome
  • @workos/authkit-tanstack-react-start version: >=0.5.0 (also happening in latest 0.11.0)
  • @workos/authkit-session version: >=0.3.4 (also happening in latest 0.7.1)
  • Tanstack Start version: 1.168.27

Additional context
@workos-inc/authkit-nextjs reads WORKOS_COOKIE_DOMAIN directly through its own env-variables.ts, so it's unaffected — this is specific to the @workos/authkit-session ConfigurationProvider used by the TanStack (and other framework) adapters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions