I am trying to use web api 2 with token based authentication. But I want to use my own database. Users are already created. I have renamed the tables in OnModelCreating, so I have proper tables names like Users, UserRole instead of Asp.netUsers etc. I change connection string for ApplicationDbContext for connect to my database.

So when I register the new user via web api, it creates the user properly in the tables, and it ok. But when i try to create a new bearer Token and when it try's to look up for the user as below, it always returns null. Not sure why. All my configs are default so I can not understand it. When I try to search for user I always get null for below. var user = await userManager.FindAsync(context.UserName, context.Password);

Do I have to do anything special to make web api 2 authentication work wiht my exisiting database?

Related posts

Recent Viewed