Base solution for your next web application
Open Closed

userManager.FindByName() returns null other than 1st rec #637


User avatar
0
antpstevens created

We are using the _userManager.FindByName("userName") method fetch the information about the user. Currently we have multiple records in AbpUsers Table . The first record Name is "admin" and second is "test".

The problem is _userManager.FindByName() always returns null other than the first record ("admin")

_userManager.FindByName("admin") - > fetch admin record properly

_userManager.FindByName("test") - > return null

Do you have any idea why this is happening ? I using this code in AccountController as we trying to implement external authenticaition with Azure Active Direcory.


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Did you added the user to database by hand? if so, maybe you missed to set right value to TenantId. Can you see test user in the Users page? Also, if you are using multi-tenancy, is this "test" user is a host user or tenant user?