@@ -167,6 +167,8 @@ export class FusionAuthClient {
167167 * @param {string } encodedJWT The encoded JWT (access token).
168168 * @param {ChangePasswordRequest } request The change password request that contains all the information used to change the password.
169169 * @returns {Promise<ClientResponse<ChangePasswordResponse>> }
170+ *
171+ * @deprecated This method has been renamed to changePasswordUsingJWT, use that method instead.
170172 */
171173 changePasswordByJWT ( encodedJWT : string , request : ChangePasswordRequest ) : Promise < ClientResponse < ChangePasswordResponse > > {
172174 return this . startAnonymous < ChangePasswordResponse , Errors > ( )
@@ -193,6 +195,25 @@ export class FusionAuthClient {
193195 . go ( ) ;
194196 }
195197
198+ /**
199+ * Changes a user's password using their access token (JWT) instead of the changePasswordId
200+ * A common use case for this method will be if you want to allow the user to change their own password.
201+ *
202+ * Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
203+ *
204+ * @param {string } encodedJWT The encoded JWT (access token).
205+ * @param {ChangePasswordRequest } request The change password request that contains all the information used to change the password.
206+ * @returns {Promise<ClientResponse<ChangePasswordResponse>> }
207+ */
208+ changePasswordUsingJWT ( encodedJWT : string , request : ChangePasswordRequest ) : Promise < ClientResponse < ChangePasswordResponse > > {
209+ return this . startAnonymous < ChangePasswordResponse , Errors > ( )
210+ . withUri ( '/api/user/change-password' )
211+ . withAuthorization ( 'Bearer ' + encodedJWT )
212+ . withJSONBody ( request )
213+ . withMethod ( "POST" )
214+ . go ( ) ;
215+ }
216+
196217 /**
197218 * Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
198219 * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
0 commit comments