so I'm trying to get asp.net to work with a custom passwordhasher. the registration works when I change the hasher with the following code
IPasswordHasher hasher = new CustomPassword();
UserManager.PasswordHasher = hasher;
but the sign in method keep saying my credentials don't exist when using the following code for the login method in the acountcontroller
IPasswordHasher hasher = new CustomPassword();
SignInManager.UserManager.PasswordHasher = hasher;
am I missing something?
I had a similar issue, and the answer was not obvious. This was done in.Net6 but I believe should be the same for whatever version you are using.
You need to make sure you add the passwordhasher before the call to AddIdentity
builder.Services.AddTransient<IPasswordHasher<ApplicationUser>, PasswordHasherService>();
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
SigninManager will then use the password hasher you defined instead of the default one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.