Skip to content

Commit e54ed1a

Browse files
authored
Merge pull request #38 from FusionAuth/wied03/issue1_develop_merge
Merge wied03/issue1_develop_merge
2 parents 5a9c95a + 39e51ac commit e54ed1a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

lib/fusionauth/fusionauth_client.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ def change_password(change_password_id, request)
134134
.go
135135
end
136136

137+
#
138+
# Changes a user's password using their access token (JWT) instead of the changePasswordId
139+
# A common use case for this method will be if you want to allow the user to change their own password.
140+
#
141+
# Remember to send refreshToken in the request body if you want to get a new refresh token when login using the returned oneTimePassword.
142+
#
143+
# @param encoded_jwt [string] The encoded JWT (access token).
144+
# @param request [OpenStruct, Hash] The change password request that contains all the information used to change the password.
145+
# @return [FusionAuth::ClientResponse] The ClientResponse object.
146+
def change_password_by_jwt(encoded_jwt, request)
147+
startAnonymous.uri('/api/user/change-password')
148+
.authorization('Bearer ' + encoded_jwt)
149+
.body_handler(FusionAuth::JSONBodyHandler.new(request))
150+
.post
151+
.go
152+
end
153+
137154
#
138155
# Changes a user's password using their identity (loginId and password). Using a loginId instead of the changePasswordId
139156
# bypasses the email verification and allows a password to be changed directly without first calling the #forgotPassword

0 commit comments

Comments
 (0)