diff --git a/src/main/python/fusionauth/fusionauth_client.py b/src/main/python/fusionauth/fusionauth_client.py index 28876ab..e635856 100644 --- a/src/main/python/fusionauth/fusionauth_client.py +++ b/src/main/python/fusionauth/fusionauth_client.py @@ -129,6 +129,23 @@ def change_password(self, change_password_id, request): .post() \ .go() + def change_password_by_jwt(self, encoded_jwt, request): + """ + Changes a user's password using their access token (JWT) instead of the changePasswordId + A common use case for this method will be if you want to allow the user to change their own password. + + Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword. + + Attributes: + encoded_jwt: The encoded JWT (access token). + request: The change password request that contains all the information used to change the password. + """ + return self.start_anonymous().uri('/api/user/change-password') \ + .authorization("Bearer " + encoded_jwt) \ + .body_handler(JSONBodyHandler(request)) \ + .post() \ + .go() + def change_password_by_identity(self, request): """ Changes a user's password using their identity (loginId and password). Using a loginId instead of the changePasswordId