@@ -440,7 +440,9 @@ public ClientResponse<ChangePasswordResponse, Errors> changePassword(String chan
440
440
* @param encodedJWT The encoded JWT (access token).
441
441
* @param request The change password request that contains all the information used to change the password.
442
442
* @return The ClientResponse object.
443
+ * @deprecated This method has been renamed to changePasswordUsingJWT, use that method instead.
443
444
*/
445
+ @ Deprecated
444
446
public ClientResponse <ChangePasswordResponse , Errors > changePasswordByJWT (String encodedJWT , ChangePasswordRequest request ) {
445
447
return startAnonymous (ChangePasswordResponse .class , Errors .class )
446
448
.uri ("/api/user/change-password" )
@@ -466,6 +468,25 @@ public ClientResponse<Void, Errors> changePasswordByIdentity(ChangePasswordReque
466
468
.go ();
467
469
}
468
470
471
+ /**
472
+ * Changes a user's password using their access token (JWT) instead of the changePasswordId
473
+ * A common use case for this method will be if you want to allow the user to change their own password.
474
+ * <p>
475
+ * Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
476
+ *
477
+ * @param encodedJWT The encoded JWT (access token).
478
+ * @param request The change password request that contains all the information used to change the password.
479
+ * @return The ClientResponse object.
480
+ */
481
+ public ClientResponse <ChangePasswordResponse , Errors > changePasswordUsingJWT (String encodedJWT , ChangePasswordRequest request ) {
482
+ return startAnonymous (ChangePasswordResponse .class , Errors .class )
483
+ .uri ("/api/user/change-password" )
484
+ .authorization ("Bearer " + encodedJWT )
485
+ .bodyHandler (new JSONBodyHandler (request , objectMapper ()))
486
+ .post ()
487
+ .go ();
488
+ }
489
+
469
490
/**
470
491
* Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
471
492
* When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
0 commit comments