Skip to content

fix(identify): send a userHash once even when the cached identity is unchanged - #200

Merged
floooat merged 1 commit into
masterfrom
fix-identify-hash-resend
Nov 4, 2026
Merged

floooat merged 1 commit into
masterfrom
fix-identify-hash-resend

Conversation

@floooat

@floooat floooat commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Symptom

Customers who pass a userHash to Gleap.identify stay unproved on the server when the browser already holds a session identified with the same userId and data without a hash. Seen in Gleap's own support widget: signed-in dashboard users identified before the dashboard started sending a hash stay unverified.

Root cause

identifySession returns early when checkIfSessionNeedsUpdate finds the cached session already has this userId and the same name/email. The userHash is not part of that check, so the request that carries it is never sent and the server never writes session.signedUserId. Only a logout (clearIdentity) or a new browser sends it.

Production data (Gleap's own support widget, contacts active since the server-side mark shipped): about 230 older contacts were proved through a logout or a new browser. About 330 others were not, although they used the dashboard after the change.

Fix

The session remembers <gleapId>:<userId> once an identify with a userHash succeeded (memory, plus the cache unless localStorage is disabled; cleared in clearSession). An identify with a userHash is sent when that record does not match the current session and user, so each browser sends the hash once and then skips again. Only the user id is stored, never the hash. Identifies without a hash behave as before.

Verification

  • New tests in src/GleapSession.test.js ("identify with a userHash on a session identified without one"): 3 of 4 fail on master (no request sent), all pass with the fix. They cover: sent once and skipped on the next page load, re-sent after a failed request, unchanged identify without a hash still skipped, record forgotten on logout.
  • Full suite: 34 suites, 590 tests passing.

Follow-up after merge: release the SDK and bump gleap in the dashboard so it ships there.

🤖 Generated with Claude Code

…unchanged (#227678)

identifySession skipped any identify whose userId and data matched the cached
session, also when it now carries a userHash. A contact identified without a
hash before (an older app version, identity verification switched on later, a
sign-up identified before it could get a hash) therefore never sent the hash,
and the server never marked it as proved (session.signedUserId). In Gleap's own
support project that kept long-signed-in dashboard users "unverified" for Kai.

The SDK now remembers `<gleapId>:<userId>` once a hashed identify landed
(memory + cache, cleared on logout) and sends a hashed identify when that record
does not match the current session and user. The hash itself is never stored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@floooat
floooat merged commit c75b120 into master Nov 4, 2026
1 check passed
@floooat
floooat deleted the fix-identify-hash-resend branch November 4, 2026 10:10
@floooat floooat mentioned this pull request Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants