HuddlekitH
Huddlekit
Oct 16

Widget session is shared across projects on the same domain

We load two projects on the same staging site (one for the client, one for our team) and pick which one to load per visitor. Sign-in happens per project (widget-login?project_key=...), but the session is stored in a single localStorage key, huddlekit_widget_auth, for the whole origin. When a team member goes from the team project to the client project, the client project gets the other project's token, treats it as expired, and clears it. Back on the team project, the member is signed out and the toolbar is gone. We worked around it by stashing the session per project key before loading the SDK, but it relies on your internal storage key. Storing the session per project (huddlekit_widget_auth_<projectKey>, for example) would fix it on your side.
CompletedCompleted

changed status toCompleted·4 days ago
4 days ago

Hi Thomas, Thanks for the precise report, you were spot on. This is fixed and live now. The widget now stores the session per project key, as you suggested, so switching between your team and client projects no longer signs anyone out. Existing sign-ins carry over, so nobody on your team has to sign in again because of the update. Your workaround won't break anything, but you can remove it. One change to be aware of: Log out in the widget now signs you out of every project on that site, not just the one you're on. If you still get signed out when switching, let me know and I'll take a look.

4 days ago

Hi Kevin, Thanks for the quick fix. I checked it on our staging: sessions are stored per project now, and switching back and forth between our team and client projects keeps everyone signed in. We removed our workaround. One small thing we noticed since the change: a team member signed in on the team project isn't recognized on the client project of the same workspace. In a new tab, the public client project doesn't show up for them until they open the share link or sign in again there. We handle it on our side by adding ?huddlekit when switching to the client project, so it's not blocking. However, if a workspace member could be recognized across all projects within the same workspace, it would make setups like ours much simpler. Thanks again!

4 days ago

Thanks, Thomas. I’m taking another look and will be in touch. I appreciate the reports! Feel free to email me directly at firstname@domain.com if anything else comes up.