MVC5 (VS2012) Identity CreateIdentityAsync - Value cannot be null
I had the same error in the past but only when I created user with Entity Framework Migration Tool. When creating a user and signing withing the website, I had not error.
My error was that I was not providing a SecurityStamp with migration.
SecurityStamp = Guid.NewGuid().ToString()
This property set, everything worked.
I had a similar problem. The Solution was to set the SecurityStamp-Property of the User-Entity.
Background: The customer want´s to have Admin-/Superuser-Accounts with passwords in the database and a bunch of additional users - who shall be able to log in without password - in an XML file...
So I inherit from the Entity Framework UserStore, override FindByIdAsync and FindByNameAsync, search the XML file for the user and return a new User-Entity. (if no user was found by the default implementation)
I had the same Exception as Jon when creating a ClaimsIdentity.
After some digging I found that my newly created User-Entities did not have a SecurityStamp. And the asp.net default UserManager expects a SecurityStamp and wants to set it as a Claim in the ClaimsIdentity.
After setting a value to that property - I used a string that contains a prefix and the username - everything works fine for me.
I faced this issue when the password is less of them 6 characters. Anything bigger than that and I don't get this error.
6 characters are the minimal default setting to it.
For sure you can change this behaviour.
services.Configure<IdentityOptions>(options => { options.Password.RequiredLength = 6; options.Password.RequireUppercase = false; options.Password.RequireLowercase = false; options.Password.RequireDigit = false; options.Password.RequireNonAlphanumeric = false; });