我正在尝试休息cognito用户的密码,我为该函数使用了以下代码
async resetPassword(event: ResetPassword) {
try {
const { email, newPassword, session } = event;
const input = {
ClientId: process.env.CLIENT_ID,
ChallengeName: ChallengeNameType.NEW_PASSWORD_REQUIRED,
ChallengeResponses: { USERNAME: email, NEW_PASSWORD: newPassword },
Session: session,
};
const command = new RespondToAuthChallengeCommand(input);
const response = await this.cognitoClient.send(command);
return sendResponse(StatusCodes.OK, {
status: ResponseStatus.SUCCESS,
message: SuccessMessages.USER_LOGGED_IN,
data: response,
});
} catch (error) {
throw error;
}
}
然后我用Postman调用API。当使用它时,我会得到以下错误。
“body”:{“name”:“InvalidParameterException”,“$fault”:“client”,
“$metadata”:{”httpStatusCode“:400,”requestId“:
“66a714b4-7a05-4eb5-ae3-cfeac186fdaa”,“尝试”:1,
“totalRetryDelay”:0},“__type”:“InvalidParameterException”}
这里可能出了什么问题?