Retrieve username or email address

Hi Team,
I came to know that, forgot username option has been removed from latest version of keycloak. The reason i saw is now keycloak is able to support login with email. I have a use case, lets say if user forgot his email address, how he can retrieve it ? Can you please guide me on this, if i have to create a custom SPI for implementing retrieve username, i can do that. Can you please let me the know the feasibility for the same ?
Thanks,
Anish

Hi Anish, if the user has forgotten their username and their email address, how do you think you can get in contact with them to tell them what it is? How do you know who they are to know which email/username to send them?

If they don’t know their email address, where do they get the information you send?
eg, my email is max@hotmail.com. So I login to hotmail.com with that email address to retrieve my mail. If I do not know my email address, where do go and which username do I use when I get there?

If you have other user information like mobile phone number, you could get them to enter their number and send them an SMS with the username. With custom code, almost anything is feasible.
Max

Hi Max,
Thanks for your quick reply :slightly_smiling_face:

If you have other user information like mobile phone number, you could get them to enter their number and send them an SMS with the username. With custom code, almost anything is feasible - This is what i want to implement.How can i do this , can you please help me ?

You need a Java developer. I’m not one!

Yes i know, i just want to know proper way of implementation, why i am asking is this, i didn’t find anything you have mentioned specifically to this in the documentation. I know a custom theme is required to incorporate new option for forgot username in login page , also may be a custom SPI has to implement for backened handling. Please correct me if i am wrong, it will be really appreciate if you can give me more details or a reference.

Keycloak has never had a forgotten username option as we allow users to login both with username and email.

With SMS for sure you could send a forgotten username/email to SMS, or you could just let folks login with their SMS instead.

In either case we don’t support SMS at the moment, so that would require quite a bit of customization to achieve.

I think you may also be able to do a custom recover password flow to do what you want as well, but it would be quite custom. Take a look at https://www.keycloak.org/docs/latest/server_development/index.html#modifying-forgot-password-credential-flow

1 Like