Asp.net Core 2 Identity WebApi
Let’s create new webapi ASP.NET Core project. Create folder UserAuthentication , and inside that folder run command dotnet new webapi . Add Swagger You can test now your app using Postman. Method: POST, url: “/api/account/register” And this is a response Status is 200 Ok. If your register form isn’t valid you will get response status 400 Bad Request and message with your errors. Now when you are registered, you can login. For that you need only your email and password. Method: POST, url: “/api/account/login” And the response is our JWT. In our controller there is one method called GetSecuredData() for testing our tokens. You can get that data only if you are logged in. Let’s try that in Postman. After you log in, copy token that you get from server and paste it in header of request. Key is Authorization and Value is “Bearer (your token here)” with one space between word Bearer and your token. Like this Don’t forget to set method GET and change u...