I have a Keycloakify project where I am customizing my Keycloak login page.
I would like to inform a new user during registration if an account with their email address already exists.
How can I achieve this?
Currently, my registration page works well, but when I click the “doRegister” button and their account already exists, I am redirected to the previous step of the registration process with the following error:
2024-12-09 15:58:21,852 WARN [org.keycloak.events] (executor-thread-18420) type=REGISTER_ERROR, realmId=bc45ac45-69aa-4bfb-a31d-8b4ecaeafe3e, clientId=muse-oidc, userId=null, ipAddress=10.212.132.4, error=email_in_use, auth_method=openid-connect, auth_type=code, register_method=form, last_name=doe, redirect_uri=https://muse-test.mnhn.fr/api/auth/callback/keycloak, first_name=John, code_id=69b2930f-9969-410d-b404-6529cf4cc0e6, email=test@email.com, [username=test.@email.com](mailto:username=test@email.com)
How can I catch this error and use it to display an error message on my form while the user is entering their information?
Is there a simpler solution provided by Keycloak to handle this issue?
I also tried using keycloak-admin-client, but I get a CORS error because I am using a different backend for my application once logged in.
For reference:
keycloakify: "ˆ9.5.8"
@keycloak/keycloak-admin-client: "ˆ26.0.7"