Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local user account store for Web API in ASP.NET Core 2.0

I'm using ASP.Net Core 2.0, I want to build a Web API project with Individual User Accounts Authorization type, but the only option is Connect to an existing user store in the cloud. Create new project screenshot

How can I add a template for Web API with Individual User Accounts with Store user accounts in-app?

This option is available for Web Application but not for Web API.

like image 828
Kahbazi Avatar asked Aug 17 '17 11:08

Kahbazi


People also ask

Where are web API tokens stored?

By default the token is not stored by the server. Only your client has it and is sending it through the authorization header to the server. If you used the default template provided by Visual Studio, in the Startup ConfigureAuth method the following IAppBuilder extension is called: app.


1 Answers

Try start your project in the console with the command

dotnet new webapi -au Individual 

You can open your project in VS after that. (to work around the dialog). Then you can use for example the authorize-attribute. But the project is still configured to use Azure Bearer Authentication. You have to decide where to get identity from. You can take identityserver4 or build your own "Custom storage providers for ASP.NET Core Identity" (MS-Docs)

The difference to MVC WebApp: here you have an account controller with views to handle registrations and get a username and password and so forth.

like image 126
Kirsten Avatar answered Oct 09 '22 14:10

Kirsten