I think I have a high level understanding of what a JWT is and how it works. I would now like to apply it to a use case, namely that the token would be used for authentication purposes, and passing along some data with it.

eg - a request is made to the server, and the bearer token represents both authentication information and a payload in one trip. Is this in alignment with best practices for JWT?

  • What kind of data? What kind of server architecture? – Ahmad May 5 at 23:38

Since JWTs are passed via headers, I would recommend a size of 5-7kb. For auth tokens, wrap them in http-only cookies, and use a seperate token for the payload. This is because http-only cookies are not readable by clientside JS. Sorry, would make this a comment but I don't have enough points. Hope this helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.