Skip to content

fix(auth): keep profile name edits when an older token signs in - #345

Merged
anantjain341 merged 1 commit into
CivicDataLab:devfrom
anantjain341:fix/keep-profile-name-edits
Dec 1, 2026
Merged

anantjain341 merged 1 commit into
CivicDataLab:devfrom
anantjain341:fix/keep-profile-name-edits

Conversation

@anantjain341

Copy link
Copy Markdown
Contributor

Fixes #343

A first or last name changed in the profile went back to the old one. Every authenticated request copied given_name/family_name from the Keycloak token onto the user, and a token keeps the name it was issued with. So the next request made with a token from before the edit put the old name back. On dev, updateUser followed by one REST request with the same token (REST sign-in has no token cache) was enough.

Names now come from Keycloak only while ours are empty: new users, or users whose name was never set. A name saved in DataSpace stays. Email, username and admin status still sync from Keycloak on every request, as before.

No API change, no migration.

Every authenticated request copied given_name/family_name from the
Keycloak token onto the user. A token keeps the name it was issued with,
so the next request made with a token from before a profile edit put the
old name back (on dev, a single REST request after updateUser did it).

Take names from Keycloak only while ours are empty; email, username and
admin flags still sync on every request.
@anantjain341
anantjain341 merged commit fdceb56 into CivicDataLab:dev Dec 1, 2026
4 checks passed
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.

1 participant