An updated version of this video is available here: • JWT authentication: How to add in ASP.NET ...
We go ahead and set up OAuth security in ASP.NET Core by creating JWT as a Bearer token.
When creating a Bearer token, we have to supply information such as:
Subject - The identity of the user being authenticated
Expires - The time (in UTC) when the token will expire
Issuer - The name of the issuer of the ticket
Audience - The name of the audience of which the ticket is intended for
Signing Credentials - A security key password, which needs to be at least 15 characters
Issued at - The time (in UTC) when the token was issued
Once we have created a Bearer token, we output the token as part of a HTTP JSON response. We can use this Bearer token using the Authorization header in a HTTP request.
Afterwards, we decrypt the Bearer token and find out what information it stores. This includes:
unique_name - The name of the user that should be authenticated with this token
nbf - Stands for "Not valid before". A timestamp to indicate the time when the token is valid from.
exp - Stands for "Expires". A timestamp to indicate when the token expires.
iat - Stands for "Issued at". A timestamp to indicate when the token was issued at.
iss - Stands for "Issuer". Basically telling us who created the token.
aud - Stands for "Audience". Who or what the token is intended for.
Finally, we set up Bearer as the default authentication scheme & authorisation policy in an ASP.NET Core app.
📖 Learn .NET and C# with our online courses 📖
https://www.roundthecode.com/dotnet-c...
► More Information: https://www.roundthecode.com/dotnet-t...
► Part 1: • How to Add Basic Authentication to an ASP....
► OAuth Security Playlist: • Playlist
#aspnetcore #oauth #bearer