feature request: allow override "sub" claim in ID Token claims
Author: therourCreated Sep 17, 2026Updated Sep 18, 2026
Labelsfeature-request
What problem did you meet?
- we already have users in our previous IdP (Auth0)
- we have existing database that store
user_idanywhere - we want to migrate our existing users to Logto
- our RP-app identified the user as different because we identify the
user_idfrom "sub" claim of the ID Token or userinfo endpoint
Describe what you'd like Logto to have
can override the ID Token claim with
return { "sub": event.context.user.customData?.legacyUserId ?? event.context.user.id }`Current Implementation
enable the custom_data claim and modify RP-app code everywhere I need the user_id based on custom_data claim and fallback to sub claim for new users
user_id = userinfo.get("custom_data", {}).get("legacyUserId") or userinfo.get("sub")Source: logto-io/logto