Have you ever scaled out a web application or an API? If so, you’ll have noticed your out-of-the-box web framework stores its user session in memory

The Case Against Token-Based Authorization

submited by
Style Pass
2022-01-13 13:30:07

Have you ever scaled out a web application or an API? If so, you’ll have noticed your out-of-the-box web framework stores its user session in memory. You may have utilized sticky sessions in response, or stored your sessions in a shared database—but these solutions aren’t without problems. For example, in a shared database, you’d need to make an extra request to the database for every HTTP request.

To account for such flaws, using a form of stateless authentication allows for better application scalability, as well as more efficient authentication of HTTP requests. Token-based authentication is perhaps the most common stateless authentication strategy, and JSON Web Tokens (JWTs) are today’s token of choice.

While using JWTs for authentication is extremely common, some application developers are building authorization and permissions directly into their web tokens, risking serious security implications as a result. Baking authorization directly into JWTs also comes with several limitations that should be avoided.

Data inside of JWTs are generally not encrypted, leaving them human-readable. While this lack of encryption is by design, it comes with some serious concerns around storing private, sensitive, and authorization-based information in JWTs. This is especially true when your organization is under certain regulatory compliance like HIPAA or SOC 2.

Leave a Comment