Identity CreateIdentityAsync - Value cannot be null

3 March 2016By Rich @Black Sand Solutions
  • Bug

Had an annoying bug today. I was developing an existing website from a new machine. I'd pulled down...

Identity CreateIdentityAsync - Value cannot be null

I'd pulled down the repo and built everything and added some seed data to the database. Otherwise no changes had been made.

But for some reason I could not login. This application is using OWIN for identity management. And each attempt to login resulted in a 500. A little digging found the error message:

Identity CreateIdentityAsync - Value cannot be null

The problem?

The script to create the default users in AspNetUsers was not populating the SecurityStamp column.

A quick update to the script and we are dancing...

insert into AspNetUsers(Id,PasswordHash, LockoutEnabled, UserName, EmailConfirmed, PhoneNumberConfirmed, TwoFactorEnabled, AccessFailedCount, SecurityStamp)
values ('454caf3e-423f-4832-baf3-61ff5ba43c88', 'AIyHG0de27OztN3c1hGO4fQIt4D/6n1npWn5rjC5wXFI4U+8RLfZbJVePU5oUCkBBB==', 'true', 'bobFleming',  'false','false','false',0,  NEWID())
insert into AspNetUserRoles (UserId, RoleId) values ('454caf3e-423f-4832-baf3-61ff5ba43ca6',3)
All Posts