changePassword returns 401
-
I am using "@fusionauth/typescript-client": "^1.42.0" and tried to use the changePassword method.
const fa = new FusionAuthClient( API_KEY, HOST, TENANT_ID ); await fa.changePassword(undefined, { loginId: userEmail, password: "newPassword", });
I always get a 401 response.
I tried with a normal http request using
axios
and it's working so I think there is an issue with thechangePassword
method.await axiosInstance.post("/api/user/change-password", { loginId: user.email, password: newPassword, });
I double checked the keys and even tried using the
retrieveUser
method which successfully returns the the user.The error response doesn't give much info. Does anyone have an idea on how to resolve?
-
Hi there!
In this scenario where you're providing the
loginId
instead of thechangePasswordId
, please use
changePasswordByIdentity():await fa.changePasswordByIdentity({ loginId: userEmail, password: "newPassword", });
-
@vinicius-campitelli thank you!