Solarion
Honorary Master
- Joined
- Nov 14, 2012
- Messages
- 28,048
- Reaction score
- 17,803
I have a small question regarding an API I've put together. I am using authentication and authorisation.
Through Swagger UI I am able to create a Login and then log in in get a token key back. All the tables are in place which were created on migration. The tables I am most interested in are AspNetUsers and AspNetUserRoles.
I have two roles which are created on migration and dbupdate.
My question is this. How do I create/register a new Login and assign that Login either Admin or Employee? Can I do it through Postman or Swagger. If so how do I go about doing this!
Through Swagger UI I am able to create a Login and then log in in get a token key back. All the tables are in place which were created on migration. The tables I am most interested in are AspNetUsers and AspNetUserRoles.
I have two roles which are created on migration and dbupdate.
C#:
if(!await roleManager.RoleExistsAsync("Admin"))
{
var adminRole = new IdentityRole("Admin");
await roleManager.CreateAsync(adminRole);
}
if (!await roleManager.RoleExistsAsync("Employee"))
{
var employeeRole = new IdentityRole("Employee");
await roleManager.CreateAsync(employeeRole);
}
My question is this. How do I create/register a new Login and assign that Login either Admin or Employee? Can I do it through Postman or Swagger. If so how do I go about doing this!
Last edited: