Login with email using custom external storage provider

I successfully implemented my custom external user storage provider that lets users login with username and password by following the instructions in User storage SPI. To this end, I implemented the getUserByUsername method from the UserLookupProvider interface and verified that it gets called when a user attempts login, returning the user.

Now I need to allow users to login with their registered email as well. I activated Login with email in realm settings for the realm. What I was expecting was getUserByEmail to be called at some point during the login process. Instead, only getUserByUsername is called with the e-mail address and fails to return the user, since it’s not searching in the email field of my external storage.

Am I wrong in my assumption that getUserByEmail would be called? Should I implement getUserByUsername so that it looks for both username and email? Thanks.

„getUserByEmail“ should be called if everything is implemented and configured properly. Your assimption is correct and it works as expected here in my environments. :man_shrugging:

Indeed it does. It calls getUserByEmail first when the input looks like an e-mail and falls back to getUserByUsername when that fails.

My issue was only a mixup between two installations. Sorry for wasting your time :pensive: