JSON Web Token (JWT) is an open standard used to securely transmit information between parties as a JSON object. It defines a compact and self-contained way for transmitting information between parties, and it is designed to be used especially in a web-browser single-sign-on (SSO) context. JWTs are typically used to pass identity of authenticated users between an identity provider and a service provider, or any other type of claims as required by business processes.
A JWT consists of three parts: header, payload, and signature. The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA. The payload holds JSON that asserts some number of claims. The signature is generated via a cryptographic algorithm that can be used to verify the integrity of the JSON payload.
JWTs are designed to be compact, URL-safe, and usable especially in a web-browser single-sign-on (SSO) context. They can be sent through a URL, through a POST parameter, or inside an HTTP header, and they are transmitted quickly. JWTs are digitally signed using either a secret (HMAC) or a public/private key pair (RSA or ECDSA) which safeguards them from being modified by the client or an attacker.
JWTs can be used for various purposes, such as authorization, single sign-on, and information exchange. 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.
In summary, JWT is a standard used to securely transmit information between parties as a JSON object. It consists of three parts: header, payload, and signature, and it is designed to be compact, URL-safe, and usable especially in a web-browser single-sign-on (SSO) context. JWTs can be used for various purposes, such as authorization, single sign-on, and information exchange.