fix(user): Updating user info when authenticating with external IDP (#11046)

# Which Problems Are Solved

User profile updates were not propagated when using External OIDC IDP +
Login V2

# How the Problems Are Solved

* `UpdateHumanUserRequest` is added to
`RetrieveIdentityProviderIntentResponse`
* `UpdateHumanUserRequest` is returned in the
`RetrieveIdentityProviderIntentResponse` when the user already exists
during external IDP auth, which is then used in the frontend to update
the user info

# Additional Changes

* Moved integration tests related to user intent to a separate test file
* Fix redirection after external IDP user registration

# Additional Context
- Closes #10838 
- Follow up: https://github.com/zitadel/zitadel/issues/11053

---------

Co-authored-by: Max Peintner <[email protected]>
This commit is contained in:
Gayathri Vijayan
2025-11-10 09:50:36 +01:00
committed by GitHub
co-authored by Max Peintner
parent a3390a0adb
commit d7e9eddb76
7 changed files with 1139 additions and 1017 deletions
+13 -2
View File
@@ -76,6 +76,17 @@ describe("processIDPCallback", () => {
email: "[email protected]",
},
},
updateHumanUser: {
username: "testuser",
profile: {
givenName: "Test",
familyName: "User 1",
displayName: "Test User 1",
},
email: {
email: "[email protected]",
},
},
};
const defaultIdp = {
@@ -257,8 +268,8 @@ describe("processIDPCallback", () => {
serviceUrl: "https://api.example.com",
request: expect.objectContaining({
userId: "user123",
profile: defaultIntent.addHumanUser.profile,
email: defaultIntent.addHumanUser.email,
profile: defaultIntent.updateHumanUser.profile,
email: defaultIntent.updateHumanUser.email,
}),
});
});
+5 -5
View File
@@ -119,7 +119,7 @@ export async function processIDPCallback({
console.log("[IDP Process] Intent retrieved successfully, processing business logic");
const { idpInformation, userId, addHumanUser } = intent;
const { idpInformation, userId, addHumanUser, updateHumanUser } = intent;
if (!idpInformation) {
console.error("[IDP Process] IDP information missing");
@@ -161,15 +161,15 @@ export async function processIDPCallback({
// ============================================
if (userId && !link) {
// Auto-update user if enabled
if (options?.isAutoUpdate && addHumanUser) {
if (options?.isAutoUpdate && updateHumanUser) {
try {
await updateHuman({
serviceUrl,
request: create(UpdateHumanUserRequestSchema, {
userId: userId,
profile: addHumanUser.profile,
email: addHumanUser.email,
phone: addHumanUser.phone,
profile: updateHumanUser.profile,
email: updateHumanUser.email,
phone: updateHumanUser.phone,
}),
});
console.log("[IDP Process] User auto-updated successfully");