Skip to content

Multitenant Plugin and autologin: tenant cookie not set #14005

@feerglas

Description

@feerglas

Describe the Bug

When using the multitenant plugin together with autologin, the cookie payload-tenant is not set.

The reproduction repo was created with the blank payload starter. I then added all the code from the multitenant-plugin folder from the payload repo.

Link to the code that reproduces this issue

https://github.com/feerglas/payload-multitenant-missing-cookie

Reproduction Steps

  • Create initial user
  • After logged in, create a new tenant
  • Create a new user (no matter which role you assign) and assign the created tenant to the user
  • delete the cookie named `payload-tenant``
  • restart the server and go to localhost:3000/admin
  • autologin automatically loggs you in
  • inspect the cookies for the page in the inspector: payload-tenant cookie is not present.
  • whereas, if you log in manually, the cookie is set after login

Which area(s) are affected? (Select all that apply)

plugin: multi-tenant

Environment Info

Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.10.0
Relevant Packages:
  payload: 3.58.0
  next: 15.4.4
  @payloadcms/db-mongodb: 3.58.0
  @payloadcms/email-nodemailer: 3.58.0
  @payloadcms/graphql: 3.58.0
  @payloadcms/next/utilities: 3.58.0
  @payloadcms/payload-cloud: 3.58.0
  @payloadcms/plugin-multi-tenant: 3.58.0
  @payloadcms/richtext-lexical: 3.58.0
  @payloadcms/translations: 3.58.0
  @payloadcms/ui/shared: 3.58.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:29 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions