Junior — Middle
What is the structure of a JSON Web Token and what are its parts?
sobes.tech AI
Answer from AI
JSON Web Token (JWT) consists of three parts separated by dots:
- Header — contains information about the token type (usually "JWT") and the signing algorithm (e.g., HS256).
- Payload — contains claims, which are the data transmitted, such as user ID, expiration time, etc.
- Signature — created by encoding the header and payload and signing them with a secret key or private key.
Example JWT:
xxxxx.yyyyy.zzzzz
where:
xxxxx— base64url-encoded Headeryyyyy— base64url-encoded Payloadzzzzz— base64url-encoded signature
This format allows secure transmission of information between parties and verification of its authenticity.