Skip to content

Commit e62dd3a

Browse files
authored
Fix #554 (#555)
1 parent 1c3f553 commit e62dd3a

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ You'll first need to create a `JWTCreator` instance by calling `JWT.create()`. U
137137
* Example using `RS256`
138138

139139
```java
140-
RSAPublicKey publicKey = //Get the key instance
141-
RSAPrivateKey privateKey = //Get the key instance
140+
RSAPrivateKey privateKey = //Get the private key instance
142141
try {
143-
Algorithm algorithm = Algorithm.RSA256(publicKey, privateKey);
142+
Algorithm algorithm = Algorithm.RSA256(null, privateKey); // only the private key is used for signing
144143
String token = JWT.create()
145144
.withIssuer("auth0")
146145
.sign(algorithm);
@@ -176,9 +175,8 @@ You'll first need to create a `JWTVerifier` instance by calling `JWT.require()`
176175
```java
177176
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJpc3MiOiJhdXRoMCJ9.AbIJTDMFc7yUa5MhvcP03nJPyCPzZtQcGEp-zWfOkEE";
178177
RSAPublicKey publicKey = //Get the key instance
179-
RSAPrivateKey privateKey = //Get the key instance
180178
try {
181-
Algorithm algorithm = Algorithm.RSA256(publicKey, privateKey);
179+
Algorithm algorithm = Algorithm.RSA256(publicKey, null); // only the public key is used during verification
182180
JWTVerifier verifier = JWT.require(algorithm)
183181
.withIssuer("auth0")
184182
.build(); //Reusable verifier instance

0 commit comments

Comments
 (0)