File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -195,6 +195,7 @@ public function changePassword($changePasswordId, $request)
195195 *
196196 * @return ClientResponse The ClientResponse.
197197 * @throws \Exception
198+ * @deprecated This method has been renamed to changePasswordUsingJWT, use that method instead.
198199 */
199200 public function changePasswordByJWT ($ encodedJWT , $ request )
200201 {
@@ -223,6 +224,27 @@ public function changePasswordByIdentity($request)
223224 ->go ();
224225 }
225226
227+ /**
228+ * Changes a user's password using their access token (JWT) instead of the changePasswordId
229+ * A common use case for this method will be if you want to allow the user to change their own password.
230+ *
231+ * Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
232+ *
233+ * @param string $encodedJWT The encoded JWT (access token).
234+ * @param array $request The change password request that contains all the information used to change the password.
235+ *
236+ * @return ClientResponse The ClientResponse.
237+ * @throws \Exception
238+ */
239+ public function changePasswordUsingJWT ($ encodedJWT , $ request )
240+ {
241+ return $ this ->startAnonymous ()->uri ("/api/user/change-password " )
242+ ->authorization ("Bearer " . $ encodedJWT )
243+ ->bodyHandler (new JSONBodyHandler ($ request ))
244+ ->post ()
245+ ->go ();
246+ }
247+
226248 /**
227249 * Check to see if the user must obtain a Trust Token Id in order to complete a change password request.
228250 * When a user has enabled Two-Factor authentication, before you are allowed to use the Change Password API to change
You can’t perform that action at this time.
0 commit comments