Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • This answer is so usefull to understand how we should create the secret and how we should handle it over JJWT. I didn't know that requirement about the length of the secret. Thanks again for that. But I think this answer is not complete. You could add something like that: using Key is more safe, since SecretKey implementation ensures destroy sensitive key information from the memory when this object is eligible for garbage collection. Commented Oct 27, 2016 at 2:53
  • @Paulo that's a nice point and should be documented in the project. Would you mind opening a GitHub issue to add that? It'd be appreciated! Commented Oct 27, 2016 at 17:58
  • @Les - Could you guide on stackoverflow.com/questions/41661821/… Commented Jan 15, 2017 at 14:44
  • Is there any dotnet library which would provide the same functionality like: Jwts.builder() //... .signWith(SignatureAlgorithm.HS512, base64Encoded) .compact();?? Commented Mar 26, 2019 at 15:17
  • 6
    This is a good answer. However, be aware that in a load balanced microservices environment, the secret should be read in from env var. Commented Mar 26, 2020 at 21:24