'Asp.net Identity user management rest api
I want to create a rest api for user management of asp.net identity. My project has a mvc client that will connect to microservices via ocelot gateway. I also use ids4 that connects to asp.net identity to login. Now I want to have user management, according to a post I read, user management is a different matter of ids4, so, I should create a different service for it. So I created a new rest api project, but I cant connect to asp.net identity. Here is my code in program.cs:
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("SQLServerConnection")));
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
When I use postman to call an endpoint to add a new user I see that I'm getting redirected to account/login which I believe is related to the AddIdentity method. I don't want that asp.net identity authenticate those requests, since I use ids4 to manage authenticate/permissions. I just want to do user management stuff, like add, delete and change password. Is there any other way to do it without using a mvc application to directly connect to asp.net identity?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|