fix(login): enable explicit IDP linking using existing session id (#11225)

Closes #11191 

# Which Problems Are Solved

This PR fixes the IDP linking for accounts with no authentication
method.
We strictly validate session ownership and generate a hash of the
sessionId + the user's fingerprintId cookie. This hash is passed to the
IDP as linkFingerprint.

This PR addtionally addresses TypeScript errors regarding unknown types
in catch blocks within the IDP intent processing logic. It ensures that
errors occurring during IDP linking are safely handled, and that
meaningful error messages are propagated to the client-side redirect
URLs.

# How the Problems Are Solved

- Safely handle unknown errors: Updated catch blocks in
`processIDPCallback` to check if the caught object is an instance of
Error before accessing error.message.
- Fix "IDP Taken" check: Implemented a safe check for the gRPC error
code 6 (Already Exists) by casting the error, resolving the Property
'code' does not exist on type 'unknown' build error.
- Error Propagation: The specific error message is now passed to the
linking-failed page params, allowing for better user feedback instead of
generic errors.
This commit is contained in:
Max Peintner
2025-12-30 14:32:37 +00:00
committed by GitHub
parent d9ecaec6bb
commit 7963cdd713
14 changed files with 1319 additions and 1036 deletions
+603 -603
View File
File diff suppressed because it is too large Load Diff