Skip to content

Commit 37e3831

Browse files
Merge pull request #49 from FusionAuth/lyle/ENG-2742/change-password-using-jwt
changePasswordUsingJWT
2 parents a48028f + 9acd61b commit 37e3831

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/main/python/fusionauth/fusionauth_client.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def change_password(self, change_password_id, request):
129129
.post() \
130130
.go()
131131

132+
@deprecated("This method has been renamed to change_password_using_jwt, use that method instead.")
132133
def change_password_by_jwt(self, encoded_jwt, request):
133134
"""
134135
Changes a user's password using their access token (JWT) instead of the changePasswordId
@@ -160,6 +161,23 @@ def change_password_by_identity(self, request):
160161
.post() \
161162
.go()
162163

164+
def change_password_using_jwt(self, encoded_jwt, request):
165+
"""
166+
Changes a user's password using their access token (JWT) instead of the changePasswordId
167+
A common use case for this method will be if you want to allow the user to change their own password.
168+
169+
Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
170+
171+
Attributes:
172+
encoded_jwt: The encoded JWT (access token).
173+
request: The change password request that contains all the information used to change the password.
174+
"""
175+
return self.start_anonymous().uri('/api/user/change-password') \
176+
.authorization("Bearer " + encoded_jwt) \
177+
.body_handler(JSONBodyHandler(request)) \
178+
.post() \
179+
.go()
180+
163181
def check_change_password_using_id(self, change_password_id):
164182
"""
165183
Check to see if the user must obtain a Trust Token Id in order to complete a change password request.

0 commit comments

Comments
 (0)