The main downside is that the representation (base64-encoded json) is pretty bulky for something that might be used in HTTP headers and URLs, but it does make them easy to debug.
The main downside is that the representation (base64-encoded json) is pretty bulky for something that might be used in HTTP headers and URLs, but it does make them easy to debug.
HTTP does not define any limit for headers, but most of the Web Servers have a default limit, Apache 8kb, IIS 16kb, nginx 4kb (see this question on SO [1]). If your JWT exceeds these limits you will get a "413 Entity Too Large".
It gets only worse if you need to use a query string instead of a header because the limits are lower and IE has a limit too [2].
Solution: carefully design your JWT, what information you will put on there. You usually don't need everything, store only the things you will use on every request, like the user id, name, email, roles are good candidates. Do not try to put the entire Facebook or Linkedin profile on a JWT.
Beside the limits, it will make the request bigger to transport and maybe even slower to verify.
[1]: http://stackoverflow.com/questions/686217/maximum-on-http-he... [2]: http://stackoverflow.com/questions/417142/what-is-the-maximu...
[0] All but six of Z85's special characters get encoded by Javascript's encodeURIComponent:
: + = ^ / ? & < > [ ] { } @ % $ #
[1] URI-safe versions of Base64 (as used by JWT) use 4 characters for every 3 bytes. Z85 uses 5 characters for every four bytes, but 17 of those 85 characters require three URI characters to represent, meaning that a Z85-encoded byte requires 1.75 URI characters per byte on average: (68 * 1 + 17 * 3) / 85 = 1.4 uri_chars/char
1.4 * 5 / 4 = 1.75 uri_chars/byte