0
我試圖解析令牌是這樣的:的oauth2 - 解析令牌總是拋出異常
Claims claims1 = Jwts.parser()
.setSigningKey(publicKey)
.parseClaimsJws(token);
但我總是得到這樣的例外:
java.lang.IllegalArgumentException: Key bytes cannot be specified for RSA signatures. Please specify a PublicKey or PrivateKey instance.
然而,當我嘗試同樣的道理用我的公衆和私鑰在https://jwt.io/,它被驗證。兩個問題:
是否需要指定私鑰?如果是這樣,我怎麼能在我的代碼中這樣做?
事實上,現在我不關心簽名驗證 - 當然在將來。目前,我會很高興回答如何解析令牌而不驗證它。