Skip to content

fix: use NES user id for cli amplitude events#526

Merged
facundo-herodevs merged 1 commit intomainfrom
664-fix-identity-id
Mar 25, 2026
Merged

fix: use NES user id for cli amplitude events#526
facundo-herodevs merged 1 commit intomainfrom
664-fix-identity-id

Conversation

@facundo-herodevs
Copy link
Member

@facundo-herodevs facundo-herodevs commented Mar 24, 2026

Summary

This PR updates CLI analytics so Amplitude uses the NES user ID as the canonical user_id, matching the identifier used downstream by eol-api.

Changes

  • Updated CLI analytics identity resolution to use nes.identity from the JWT instead of relying on sub.
  • Normalized nes.identity so it works whether the claim is returned as a string or number.
  • Kept the existing behavior of not falling back to sub when nes.identity is missing.
  • Simplified the analytics identity flow in analytics.svc.ts by removing unnecessary intermediate mapping.
  • Removed the temporary auth_sub handling from the CLI after confirming the real access token used by the CLI does not include a sub claim.

Result

  • Amplitude events emitted by the CLI now use the same canonical user identifier as eol-api.
  • CLI analytics no longer depend on Keycloak sub for user identification.
  • The implementation is smaller and more explicit about the source of truth for user_id.

https://github.com/neverendingsupport/data-and-integrations/issues/664

@facundo-herodevs facundo-herodevs requested a review from a team as a code owner March 24, 2026 18:04
@facundo-herodevs facundo-herodevs merged commit e25556b into main Mar 25, 2026
12 checks passed
@facundo-herodevs facundo-herodevs deleted the 664-fix-identity-id branch March 25, 2026 12:11
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.

3 participants