August 2017
Beginner
374 pages
10h 41m
English
After learning what a JWT token looks like and how to generate them, we will cover how to use them. The most common method is to pass tokens via the Authorization header (of an HTTP request), as follows:
Authorization: Bearer <token>
With our example token, the header would look like this:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkYW4iLCJuYW1lIjoiRGFuaWVsIEJ1Z2wiLCJhZG1pbiI6dHJ1ZX0.unKmM4IFTqAYzZjTL5SPpWljafhduePjmZAoGVppHAY
Just like session IDs being stored in cookies, JWT is a stateless authentication mechanism. The server does not need to handle sessions besides handing out and verifying tokens. In addition to that, JWTs are self contained, so there is no need to query the database multiple ...
Read now
Unlock full access