[BUG] - activeOrganizationId is not set correctly in session when using secondaryStorage. #248

Closed
opened 2026-03-13 07:39:42 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @Veskel01 on GitHub (Nov 19, 2024).

Describe the bug
activeOrganizationId is not set correctly in session when using secondaryStorage (Redis).

To Reproduce
Steps to reproduce the behavior:

  1. Pass secondaryStorage option in auth config.
  2. Set activeOrganizationId via API

Expected behavior
activeOrganizationId should appear in the session

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Additional context

  1. Call to set activeOrganization
  2. Session response
  await performServerAuthCall((api) =>
    api.setActiveOrganization({
      body: {
        organizationId: 'J38J_Mmd-ZPLNBfdlaR68'
      },
      headers: headerList
    })
  );
{
    "user": {
        "id": "exfW8P93F94Mivuh-j-Tf",
        "name": "name",
        "email": "email",
        "emailVerified": false,
        "image": "image",
        "createdAt": "2024-11-19T13:44:06.801Z",
        "updatedAt": "2024-11-19T13:44:06.801Z",
        "role": "USER",
        "banned": null,
        "banReason": null,
        "banExpires": null
    },
    "session": {
        "id": "71v1xzs0sFNeeHpvVmcXn0JOn5sqNLks",
        "userId": "exfW8P93F94Mivuh-j-Tf",
        "expiresAt": "2024-11-26T14:02:52.375Z",
        "ipAddress": "::1",
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
    }
}
Originally created by @Veskel01 on GitHub (Nov 19, 2024). **Describe the bug** activeOrganizationId is not set correctly in session when using secondaryStorage (Redis). **To Reproduce** Steps to reproduce the behavior: 1. Pass secondaryStorage option in auth config. 2. Set activeOrganizationId via API **Expected behavior** activeOrganizationId should appear in the session **Desktop (please complete the following information):** - OS: Windows 11 - Browser Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 **Additional context** 1. Call to set activeOrganization 2. Session response ```ts await performServerAuthCall((api) => api.setActiveOrganization({ body: { organizationId: 'J38J_Mmd-ZPLNBfdlaR68' }, headers: headerList }) ); ``` ```json { "user": { "id": "exfW8P93F94Mivuh-j-Tf", "name": "name", "email": "email", "emailVerified": false, "image": "image", "createdAt": "2024-11-19T13:44:06.801Z", "updatedAt": "2024-11-19T13:44:06.801Z", "role": "USER", "banned": null, "banReason": null, "banExpires": null }, "session": { "id": "71v1xzs0sFNeeHpvVmcXn0JOn5sqNLks", "userId": "exfW8P93F94Mivuh-j-Tf", "expiresAt": "2024-11-26T14:02:52.375Z", "ipAddress": "::1", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" } } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#248