Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Confirm the guest session exists before submitting

Luke Vellad09d234018b5
diff --git a/apps/web/src/features/user/client.tsx b/apps/web/src/features/user/client.tsx
index 99b93cb9d..e24a13b6a 100644
--- a/apps/web/src/features/user/client.tsx
+++ b/apps/web/src/features/user/client.tsx
@@ -81,6 +81,14 @@ export function useUser() {
try {
const { error } = await authClient.signIn.anonymous();
result = toGuestSessionResult(error);
+ if (result.ok) {
+ // A browser that blocks cookies drops Set-Cookie and still
+ // reports success, so only reading the session back proves it.
+ const { data: session } = await authClient.getSession();
+ if (!session?.user) {
+ result = { ok: false, reason: "sessionUnavailable" };
+ }
+ }
} catch {
result = { ok: false, reason: "sessionUnavailable" };
}