79421597

Date: 2025-02-07 16:47:01
Score: 0.5
Natty:
Report link

So, the reason for my problem is that in the UpdateUserCommandHandler class, I update the user, including their UserName, which in the Identity database is literally a copy of the Email column. Digging into how the login endpoint works (which comes from Identity), I discovered that the login process searches for the user by their UserName rather than their Email: documentation.

This is very misleading when using Swagger because the "example value" suggests entering an email address, which is confusing. By default, if no changes are made to the user, the UserName indeed receives the email address as a copy of Email. However, since I update the UserName, entering the email address during login results in a 401 Unauthorized error. On the other hand, when I use the user's UserName for login, everything works correctly.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: KopyKay