I want to move from ASP.NET MVC Identity to node.js. I have the following field in my database:
PasswordHash: AOCB5TrZGusq9ZUdYd/w/u7GUZTPOMG7JhFd4JgS0gLOulL8QjZRbl4T6sPXwD3lfQ==
The password is asdfgak. I have no idea how to use this PasswordHash and how to get the hash and salt from it to login users from node.js.
I saw this answer but it didn't help at all, the output from this was the following:
A+w9Dyfupc+dMkViA0eYF4ol7HhdIfVPct6o47a+n5M=
Here is the code that I have in my MVC project, if that helps:
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
// my custom fields like username, gender...
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("Personal", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
Ok, I found this module where you can even choose between sync & async, it's awesome:
https://www.npmjs.com/package/aspnet-identity-pw
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With