我正在尝试休息cognito用户的密码,我为该函数使用了以下代码
async resetPassword(event: ResetPassword) {
try {
const { email, newPassword, session } = event;
const input = {
UserPoolId: process.env.USER_POOL_ID,
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。当使用它时,我会得到以下错误。
“身体”:{
“name”:“InvalidParameterException”,
“$fault”:“客户端”,
“$metadata”:{
“httpStatusCode”:400,
“requestId”:“66a714b4-7a05-4eb5-ae3-cfeac186fdaa”,
“尝试次数”:1,
“totalRetryDelay”:0
},
“__type”:“InvalidParameterException”
}
这里可能出了什么问题?