Skip to content

ASP.NET 6 Web API (Create JWT) (User Registration / Login / Authentication)

Notifications You must be signed in to change notification settings

ahmetulucay/jwtWebApi

Repository files navigation

How to add User Roles & authenticate w Azure using JWT ?

.NET 6 Web API (Create JSON Web Tokens (JWT)) (User Registration / Login / Authentication)

JWTWebApi_Program cs

  1. Add UserDto.cs in App= (Username, Password)

JWTWebApi_User UserDto cs

  1. Add User.cs in App = (Username, PasswordHash, PasswordSalt)

  2. Add Api Controller-Empty (AuthController.cs) into Controller=

JWTWebApi_AuthController cs

(Create a method for CreatePasswordHash() method ) (Create a method for VerifyPasswordHash() method ) (Create a method to register user/ [HttpPost("register")]) (Create a method to login user/ [HttpPost("login")] (Create a method for CreateToken() method )

  1. Add a new section to AppSettings.json= (Add "AppSettings"{Token: ...............}.)

  2. Add a constructor (public AuthController{IConfiguration ...}) into AuthController.cs (Continue to create a method for CreateToken() method )

  3. Controll jwt token at jwt.io internet side


About

ASP.NET 6 Web API (Create JWT) (User Registration / Login / Authentication)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages