asp .net core Jwt Security Token

Issuer and SecurityKey

To generate Jwt Security Token in core, we have to declare variables that are required for the token to be generated based on. Those variables are Issuer and SigningKey, we can put these variables in appsettings.json so we can read it later.


Now to add jwtbearer middleware, we need to register it in the startup file. While registering the middleware, we must set the token validation parameters accordingly.

Then setup a controller to generate the token, a user just have to send a request to a particular route to get the Json Web Token. The response would be a json object with the token property inside.