How do I handle a changed Terra user ID after reauth?
When a Terra user ID changes, the user reauthenticated (reconnected the same provider account under the same reference_id).
When a Terra user ID changes, the user reauthenticated (reconnected the same provider account under the same reference_id). Terra issues a new terra_user_id and sends a user_reauth webhook that includes the old_user_id.
Add handling for user_reauth:
Use
old_user_idto map the new id to the previous one (stitching historic data across reauths without needing a fresh backfill).Treat it like a deauth of the old id. The subsequent
authwebhook creates the new id.
If you match webhooks on both reference_id and user_id, you must process user_reauth so the new id is recognised.
A common cause of reconnects appearing to 'not work' is the reauth flow not reusing the original reference_id: a new reference_id creates a new Terra user and orphans the old one, so key the widget call on a stable internal user ID. See handling authentication events.
Last updated
Was this helpful?