JSON Web Tokens (JWT) in .NET 8 Web API 🔒 - User Registration / Login / Authentication

preview_player
Показать описание
JSON Web Tokens (JWT) in .NET 8 Web API 🔒 - User Registration / Login / Authentication

A JSON web token(JWT) is JSON Object which is used to securely transfer information over the web(between two parties). It can be used for an authentication system and can also be used for information exchange. The token is mainly composed of header, payload, signature. These three parts are separated by dots(.)

Header
A header in a JWT is mostly used to describe the cryptographic operations applied to the JWT like signing/decryption technique used on it. It can also contain the data about the media/content type of the information we are sending.

{
"typ":"JWT",
"alg":"HS256"
}

Payload
The payload is the part of the JWT where all the user data is actually added. This data is also referred to as the ‘claims’ of the JWT. This information is readable by anyone so it is always advised to not put any confidential information in here.

{
"userId":"b07f85be-45da",
"sub": "auth/some-hash-here",
"exp": 153452683
}

Signature
This is the third part of JWT and used to verify the authenticity of token. BASE64URL encoded header and payload are joined together with dot(.) and it is then hashed using the hashing algorithm defined in a header with a secret key. T

JWT Example :

header:

{
"alg" : "HS256",

"typ" : "JWT"
}

Payload:

{
"id" : 123456789,

"name" : "Manoj"
}

Secret: manojdeshwal
JSON Web Token

Tools Used: Visual Studio 2022, Swagger and Postman

☕ Buy me a Coffee (Channel Support through Donation)

📻 Recommended Courses

Subscribe to this channel

Must buy Programming Laptops :

Share, Support, Subscribe Now :

⭐️Tags : ⭐️

#JWTToken
#.netcoretoken
#.netcorewebapitoken

⭐️ Your Queries : ⭐️

How does JWT authentication work? || What is JWT authentication in REST API? || Is JWT better than session? || Is JWT the same as OAuth? ||
JWT Authentication || JWT authentication: Best practices and when to use it || What Is JWT? How Does It Work? ||
JWT Token Authentication And Authorizations In .Net Core 8.0 || Is there any JSON Web Token (JWT) example in C# ||
Jwt .Net 8 , a JWT (JSON Web Token) implementation for .NET core 8 || Create and Sign a JSON Web Token (JWT) with C# and .Net core 8 ||
how to access the api with jwt token .net 8 || NET 8.0 - JWT Authentication Tutorial with Example API ||
How to implement JWT autentication in ASP Core Net 8 || ‍ Authentication And Authorization In .NET Core Web API
token authentication
token authentication explained
token authentication c#
token authentication vs jwt
token authentication postman
jwt
jwt token
jwt authentication
json web token
json web token authentication

Thanks for watching. 😊😊 🙏🙏
Рекомендации по теме
Комментарии
Автор

Mid way into video and I can see already that you are a good teacher. Great work bro. Thank you

aguelejoseph
Автор

Hello sir, waiting for your next video. Long gap, didn't see any update. Please keep uploading regularly. I like all your video tutorials. Thank you. 😊

MarryA-qcsy
Автор

very nice explanation with implementation of JWT Token Authentication.

ShwetaKadam-gtcn
Автор

Superb! very nice way to create JWT. but if u mention the the details about header payload signature in the video then it will greate for the junior developers, this type of question ask in interview, Thank for the video.

jennasyeda
Автор

thank you sir, i will waiting for next video to add refresh token. Because i want to know, how to implement refresh token if access token expired.

iwandev
Автор

very good you have explained in very simple way

vimleshsharma
Автор

Thank you for the explanation and code example

lauwwulan
Автор

thank you very much :), greetings from Mexico

CarlosEnriqueDuarteOrtiz
Автор

But why all this when .NET 8 already has auth endpoints to generate that?

broadshare
Автор

Can you please post the video of refresh Token generation .. Thanks in Advance..

phanimudapaka
Автор

how to consume this api in mvc application with token....please

SonuKumar-nkgw
Автор

Can you post the Project to create a project management tool for the frontend using react js and backend use web api .net and database use sql server can post for me with in two days

KrishnaRaj-hwje
Автор

Hi

Can we pass Authorization bearer token in swagger itself is there any reference

sweetysnehith
Автор

could you pls give the source code sirr

sivamariyappan
Автор

do you have a video where you connected your database and created model? i missing on that point. new to programming

rishumehta
visit shbcf.ru