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
axiosand it's working so I think there is an issue with thechangePasswordmethod.await axiosInstance.post("/api/user/change-password", { loginId: user.email, password: newPassword, });I double checked the keys and even tried using the
retrieveUsermethod 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
loginIdinstead of thechangePasswordId, please use
changePasswordByIdentity():await fa.changePasswordByIdentity({ loginId: userEmail, password: "newPassword", }); -
@vinicius-campitelli thank you!