State value does not match after user account link on redirection '/continue'

I am implementing User Account Linking using Actions.

According to the Example account linking with Actions, I am using api.redirect.sendUserTo to trigger the User Account Link function in my backend (using Management API).
In my backend, I am linking the user who just logged in with the user who previously had the same email.
In this process, the secondary user who just logged in is deleted because it is integrated with the primary user.
At this time, when I call /continue to resume the authorization flow, the state value does not match and it fails.

If I do not perform the user link function in my backend, the state value matches normally and goes to onContinuePostLogin.
Is it because the secondary user who just logged in was deleted and the state does not match?

How should I handle this?

Hi,

This may be happening due to the deletion of the secondary user, which causes a mismatch in the state value when calling /continue…because after linking accounts, the system expects one unique user_id, and deleting the secondary user disrupts this process.
You could consider linking users after the redirection has completed and use user_metadata flags to manage account linking

Hope this helps!