From 10231b0333a3e33c3f3ffd3bda5bb0fcafb8ddd5 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Thu, 9 Jul 2026 23:52:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9(backend)=20identify=20externally?= =?UTF-8?q?=20provisioned=20users=20to=20PostHog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the external API, applications authenticate with a client_id/secret and can provision users with only an email. In that flow, users are not identified to PostHog, so the user DB id alone is not enough to identify them in analytics afterwards. The issue does not exist in the public API, where users are authenticated and therefore already identified. Inspired by @flochehab's approach in summary. --- CHANGELOG.md | 4 ++++ src/backend/core/external_api/viewsets.py | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8722bdad..ddb315f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ and this project adheres to - 🗑️(settings) deprecate SUMMARY_SERVICE_VERSION=1 - ⬆️(mail) update mjml to v5 and @html-to/text-cli +### Fixed + +- 🩹(backend) identify externally provisioned users to PostHog + ## [1.23.0] - 2026-07-08 ### Added diff --git a/src/backend/core/external_api/viewsets.py b/src/backend/core/external_api/viewsets.py index 6ee434d2..093961a6 100644 --- a/src/backend/core/external_api/viewsets.py +++ b/src/backend/core/external_api/viewsets.py @@ -215,5 +215,6 @@ class RoomViewSet( "client_id": client_id, "external_api": True, "auth_method": auth_method, + "$set": {"email": self.request.user.email}, }, )