SlideShare a Scribd company logo
1 of 12
JSON Web Token
(JWT)
Prashant Walke
Overview
What is JSON Web Token?
JSON Web Tokens Uses
● Authorization
● Information Exchange
How do JSON Web Tokens work
What is JSON Web Token?
● JWT is an open standard (RFC 7519) that defines a compact and
self-contained way for securely transmitting information
between parties as a JSON object.
● This information can be verified and trusted because it is
digitally signed.
● JWTs can be signed using a secret (with the HMAC algorithm) or
a public/private key pair using RSA or ECDSA.
JSON Web Tokens Uses
Authorization
● Once the user is logged in,
each subsequent request
will include the JWT,
allowing the user to access
routes, services, and
resources that are
permitted with that token.
Information Exchange
● JSON Web Tokens are a
good way of securely
transmitting information
between parties
Why should we use JSON Web Tokens?
● Security - Securely transmitting information between parties using public/private key
pairs
● Ease - Ease of client-side processing of the JSON Web token on multiple platforms,
especially mobile.
● Compact -Because of its size, it can be sent through an URL, POST parameter, or
inside an HTTP header. Additionally, due to its size its transmission is fast.
● Self-Contained - The payload contains all the required information about the user, to
avoid querying the database more than once.
How do JSON Web Tokens
work?
JWT format
header.payload.signature
● Header - consists of two parts: the type of the token, which is
JWT, and the signing algorithm being used, such as HMAC
SHA256 or RSA.
For example: {
"alg": "HS256",
"typ": "JWT"
}
JWT format
header.payload.signature
● Payload- Contains the claims. Claims are statements about
an entity (typically, the user) and additional data. There are
three types of claims: registered, public, and private claims.
For example: {
"user_id": "4"
}
JWT format
header.payload.signature
● Signature - To create the signature part you have to take the
encoded header, the encoded payload, a secret, the algorithm
specified in the header, and sign that.
For example (HMAC SHA256 algorithm):
HMACSHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),
secret)
JWT format
Authentication
Server
User Sign In ([username/password])
User Authenticated, JWT Created and return to USER
1
2
{header.payload.signature
}
{JWT}
User
Application
Server
User passes [JWT] When making API Calls3
Application verifies and processes API Call4
JWT to verify the authenticity of a user
● User first signs into the authentication server using the authentication server’s login
system (e.g. username and password, Facebook login, Google login, Twitter etc).
● The authentication server then creates the JWT and sends it to the user.
● When the user makes API calls to the application, the user passes the JWT along with
the API call.
● In this setup, the application server would be configured to verify that the incoming
JWT are created by the authentication server
● When the user makes API calls with the attached JWT, the application can use the JWT
to verify that the API call is coming from an authenticated user.
Conclusion
Definitely having reliable way to
authenticate user is the first thing
on the list and using JWT
Authentication as an best
authentication method.

More Related Content

What's hot

[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
洪 鹏发
 

What's hot (20)

Using JSON Web Tokens for REST Authentication
Using JSON Web Tokens for REST Authentication Using JSON Web Tokens for REST Authentication
Using JSON Web Tokens for REST Authentication
 
Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
Getting Started with Spring Authorization Server
Getting Started with Spring Authorization ServerGetting Started with Spring Authorization Server
Getting Started with Spring Authorization Server
 
[Final] ReactJS presentation
[Final] ReactJS presentation[Final] ReactJS presentation
[Final] ReactJS presentation
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Spring Framework - Spring Security
Spring Framework - Spring SecuritySpring Framework - Spring Security
Spring Framework - Spring Security
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Spring Security
Spring SecuritySpring Security
Spring Security
 
Authenticating Angular Apps with JWT
Authenticating Angular Apps with JWTAuthenticating Angular Apps with JWT
Authenticating Angular Apps with JWT
 
Spring security oauth2
Spring security oauth2Spring security oauth2
Spring security oauth2
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
NestJS
NestJSNestJS
NestJS
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 

Similar to Json Web Token - JWT

The OpenID Connect Protocol
The OpenID Connect ProtocolThe OpenID Connect Protocol
The OpenID Connect Protocol
Clément OUDOT
 
5 easy steps to understanding json web tokens (jwt)
5 easy steps to understanding json web tokens (jwt)5 easy steps to understanding json web tokens (jwt)
5 easy steps to understanding json web tokens (jwt)
Amit Gupta
 
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST
guestb2ed5f
 

Similar to Json Web Token - JWT (20)

Json web tokens
Json web tokensJson web tokens
Json web tokens
 
API
APIAPI
API
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
Micro Web Service - Slim and JWT
Micro Web Service - Slim and JWTMicro Web Service - Slim and JWT
Micro Web Service - Slim and JWT
 
Jwt with flask slide deck - alan swenson
Jwt with flask   slide deck - alan swensonJwt with flask   slide deck - alan swenson
Jwt with flask slide deck - alan swenson
 
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
InterCon 2016 - Segurança de identidade digital levando em consideração uma a...
 
iMasters Intercon 2016 - Identity within Microservices
iMasters Intercon 2016 - Identity within MicroservicesiMasters Intercon 2016 - Identity within Microservices
iMasters Intercon 2016 - Identity within Microservices
 
Towards Interoperability between W3C Web of Things and NGSI-LD
Towards Interoperability between W3C Web of Things and NGSI-LDTowards Interoperability between W3C Web of Things and NGSI-LD
Towards Interoperability between W3C Web of Things and NGSI-LD
 
Introduction to SAML & OIDC
Introduction to SAML & OIDCIntroduction to SAML & OIDC
Introduction to SAML & OIDC
 
FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...
FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...
FIWARE Global Summit - The Way Towards Interoperability between Web Of Things...
 
Building IAM for OpenStack
Building IAM for OpenStackBuilding IAM for OpenStack
Building IAM for OpenStack
 
The OpenID Connect Protocol
The OpenID Connect ProtocolThe OpenID Connect Protocol
The OpenID Connect Protocol
 
5 easy steps to understanding json web tokens (jwt)
5 easy steps to understanding json web tokens (jwt)5 easy steps to understanding json web tokens (jwt)
5 easy steps to understanding json web tokens (jwt)
 
2016 pycontw web api authentication
2016 pycontw web api authentication 2016 pycontw web api authentication
2016 pycontw web api authentication
 
Securing RESTful API
Securing RESTful APISecuring RESTful API
Securing RESTful API
 
Apache Knox Gateway "Single Sign On" expands the reach of the Enterprise Users
Apache Knox Gateway "Single Sign On" expands the reach of the Enterprise UsersApache Knox Gateway "Single Sign On" expands the reach of the Enterprise Users
Apache Knox Gateway "Single Sign On" expands the reach of the Enterprise Users
 
Scalable Reliable Secure REST
Scalable Reliable Secure RESTScalable Reliable Secure REST
Scalable Reliable Secure REST
 
Keycloak SSO basics
Keycloak SSO basicsKeycloak SSO basics
Keycloak SSO basics
 
Ssl https
Ssl httpsSsl https
Ssl https
 
Uniface Lectures Webinar - Application & Infrastructure Security - JSON Web T...
Uniface Lectures Webinar - Application & Infrastructure Security - JSON Web T...Uniface Lectures Webinar - Application & Infrastructure Security - JSON Web T...
Uniface Lectures Webinar - Application & Infrastructure Security - JSON Web T...
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Recently uploaded (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Json Web Token - JWT

  • 2. Overview What is JSON Web Token? JSON Web Tokens Uses ● Authorization ● Information Exchange How do JSON Web Tokens work
  • 3. What is JSON Web Token? ● JWT is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. ● This information can be verified and trusted because it is digitally signed. ● JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA.
  • 4. JSON Web Tokens Uses Authorization ● Once the user is logged in, each subsequent request will include the JWT, allowing the user to access routes, services, and resources that are permitted with that token. Information Exchange ● JSON Web Tokens are a good way of securely transmitting information between parties
  • 5. Why should we use JSON Web Tokens? ● Security - Securely transmitting information between parties using public/private key pairs ● Ease - Ease of client-side processing of the JSON Web token on multiple platforms, especially mobile. ● Compact -Because of its size, it can be sent through an URL, POST parameter, or inside an HTTP header. Additionally, due to its size its transmission is fast. ● Self-Contained - The payload contains all the required information about the user, to avoid querying the database more than once.
  • 6. How do JSON Web Tokens work?
  • 7. JWT format header.payload.signature ● Header - consists of two parts: the type of the token, which is JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA. For example: { "alg": "HS256", "typ": "JWT" }
  • 8. JWT format header.payload.signature ● Payload- Contains the claims. Claims are statements about an entity (typically, the user) and additional data. There are three types of claims: registered, public, and private claims. For example: { "user_id": "4" }
  • 9. JWT format header.payload.signature ● Signature - To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that. For example (HMAC SHA256 algorithm): HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)
  • 10. JWT format Authentication Server User Sign In ([username/password]) User Authenticated, JWT Created and return to USER 1 2 {header.payload.signature } {JWT} User Application Server User passes [JWT] When making API Calls3 Application verifies and processes API Call4
  • 11. JWT to verify the authenticity of a user ● User first signs into the authentication server using the authentication server’s login system (e.g. username and password, Facebook login, Google login, Twitter etc). ● The authentication server then creates the JWT and sends it to the user. ● When the user makes API calls to the application, the user passes the JWT along with the API call. ● In this setup, the application server would be configured to verify that the incoming JWT are created by the authentication server ● When the user makes API calls with the attached JWT, the application can use the JWT to verify that the API call is coming from an authenticated user.
  • 12. Conclusion Definitely having reliable way to authenticate user is the first thing on the list and using JWT Authentication as an best authentication method.