Skip to content

Commit 22f8cf8

Browse files
add changePasswordByJWT (#43)
1 parent b437a2e commit 22f8cf8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/python/fusionauth/fusionauth_client.py

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

132+
def change_password_by_jwt(self, encoded_jwt, request):
133+
"""
134+
Changes a user's password using their access token (JWT) instead of the changePasswordId
135+
A common use case for this method will be if you want to allow the user to change their own password.
136+
137+
Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
138+
139+
Attributes:
140+
encoded_jwt: The encoded JWT (access token).
141+
request: The change password request that contains all the information used to change the password.
142+
"""
143+
return self.start_anonymous().uri('/api/user/change-password') \
144+
.authorization("Bearer " + encoded_jwt) \
145+
.body_handler(JSONBodyHandler(request)) \
146+
.post() \
147+
.go()
148+
132149
def change_password_by_identity(self, request):
133150
"""
134151
Changes a user's password using their identity (loginId and password). Using a loginId instead of the changePasswordId

0 commit comments

Comments
 (0)