I just documented how it should be done, in the article at the top of the page. The answer is "don't use JWT." Use specific tools for the thing you are actually trying to do, that have API's that are harder to mess up.
In this case:
- crypto_auth, or HMAC-SHA256 by itself, for authentication
- crypto_secretbox for symmetric encryption
- crypto_box or TLS for public key encryption
That sounds like it would require a greater amount of knowledge to do correctly than "careful JWT".
It also ignores the role JWT plays in promoting bad security practices