ASP.NET Core 2.2 - API for User Management, Authentication and Registration
For documentation and instructions check out http://jasonwatmore.com/post/2018/06/26/aspnet-core-21-simple-api-for-authentication-registration-and-user-management
ASP.NET Core 2.2 API for User Management, Authentication and Registration
License: MIT License
ASP.NET Core 2.2 - API for User Management, Authentication and Registration
For documentation and instructions check out http://jasonwatmore.com/post/2018/06/26/aspnet-core-21-simple-api-for-authentication-registration-and-user-management
this project used mvc ControllerBase, when should we use ApiController?
Hi Jason, thanks so much for the code, it's really useful and very educational.
I was looking at the Authenticate method and wondering a few things:
UserDto
as a parameter but it only actually needs and uses the the Username
and Password
properties from that object. Would it be more obvious to people consuming the API if the username and password were simply parameters, or if there was a CredentialsDto
that just had the username and password?Authenticate
method, so documentation builders like Swagger won't describe the endpoint fully for anyone who's going to use the endpoint. Would it be worth defining a LoggedInUserDto
object instead of the anonymous object that's currently returned so the method can then be set to ActionResult<LoggedInUserDto>
?Happy to stick in a pull request with those changes if you think they would be useful
Yes I figured it out soon..I Checked register method with below code and Postaman returns with success.
public IActionResult Register([FromForm]UserDto userDto)
{
// map dto to entity
var user = _mapper.Map(userDto);
return Ok(new
{
user
});
but if exact code is in place in Register method. then the execution flow hit by another blocker.
Postman request
Exception :
What the reasoning of not using it and is it possible to use instead of the custom user service?
I'm creating an API without a frontend. I'm able to create a new user and log in with the account, but how do I access the user from within a controller without sending the username and password each time I want to access the API?
Hello Jason,
Thank you very much, your articles and codes are very helpful to me as a newbie now.
I am trying to build a blog webapi with forking this repository, I use Npgsql connect to a PostgreSQL database, and add some methods, but the database return error message "too many clients connected" when I debugging.
So how to close the connections in webapi? I read some documents but can't find a way to do with it.
my repo fork from yours :
https://github.com/Rackar/aspnet-core-registration-login-api
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.