File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments