2
我正在servlet上使用jjwt Java庫進行jwt的服務器端生成,直接從jjwt GitHub頁面https://github.com/jwtk/jjwt下面的代碼snipper生成並打印出此令牌。使用Java生成的JJWT簽名在jwt.io調試器上失敗
eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJKb2UifQ.XIKER3owR8BS3Krhsksg9INh9VBSejdn_qN-ONtPans
String compactJws = Jwts.builder()
.setSubject("Joe")
.signWith(SignatureAlgorithm.HS256, "secret")
.compact();
PrintWriter out = response.getWriter();
out.println(compactJws);
然而,當我試圖覈實jwt.io的調試器這個令牌,失敗簽名檢查。 Both checking and unchecking secret base64 encoded didn't work
我錯誤地使用庫嗎?