29. What is the difference between authentication and authorization? How do sessions and JWTs compare?
MediumWeb & APIs
Technical
Show model answer
Authentication proves who you are; authorization decides what you may do.
Server sessions store state on the server and give the client an opaque cookie; they are easy to revoke. JWTs are signed tokens carrying claims, so servers can verify them without a lookup, but revocation is harder, so keep them short-lived and never trust unsigned client data.