Skip to content

add changePasswordByJWT #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/main/python/fusionauth/fusionauth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down