

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Authentication With Passwords
incomplete
2: Password Review
incomplete
3: Types of Authentication
incomplete
4: JWTs
incomplete
5: Authentication With JWTs
incomplete
6: JWT Review
incomplete
7: Revoking JWTs
incomplete
8: Refresh Tokens
incomplete
9: Cookies
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
JWTs are cryptographically signed JSON objects that contain information about an authenticated user.
I've heard "JWT" pronounced as "jot", but I pronounce it "jay double yoo tee".
We'll talk about MACs, HMACs, and digital signatures in Learn Cryptography, which are the cryptographic concepts that power JWTs. For now, it's just important to know that once the token is created by a server, the data in the token can't be changed without the server being aware of it.
When your server issues a JWT to Bob, Bob can use that token to make requests as Bob to your API. Bob won't be able to change the token to make requests as Alice.
JWTs are not encrypted. Anyone who has the token can read the data (like the expiry and the user id) in the token. This is why you should never store sensitive information in a JWT. It's just a way to authenticate a user.
I like using JWT.io to inspect JWTs. It is a great tool playing around with them and learning how they work.