Introducing JWT and OAuth2
The modern REST API implements token-based authentication. Here, tokens can be any strings generated by the server, which allows the client to access resources by producing a token. The token is computed in such a way that only the client and the server know how to encode/decode the token.
The previous example relates to session-based authentication. This has a limitation of managing sessions by saving them in the program memory, or Redis/SQLite3. JWT takes a different approach and creates tokens that can be passed around for authentication.
Whenever a Client passes the authentication details to the Server, the server generates a token and passes it back to the Client. The client saves that in some kind of storage, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access