How to stop success method of registration Flow?


I’m working on custom registration flow, i need to save some data in an other database and in case it’s fail I need to rollback (remove user from keycloak database …), so i wanted to know if there is a way to stop success method. I succed to remove the user but after that the auto login after register fail with a NullPointerException because the user does’nt exist anymore.




the question isn’t all that clear, but from what I understand is that during a custom registration flow you are persisting some details to an external source and on failure you want to rollback the user creation.
So the registration can’t be a success if this is the case.

I’ve done something similar where I wanted to call an external API to send some data.
On failure of that call I needed to not persist that user.
You can check it on Created user not immediately available on event
It’s more on the bottom answers as these are talking about the custom transaction I needed to create to hook into the transaction process of the registration process.
Take especially a note of the enlistPrepare method that I used as this is needed to actual do the rollback

1 Like

Yes that exactly what i was trying to explain, i will take a look and come back to you, Thanks