代码之家  ›  专栏  ›  技术社区  ›  nethsrk

尝试重置密码cognito时出现InvalidParameterException

  •  0
  • nethsrk  · 技术社区  · 3 年前

    我正在尝试休息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”}

    enter image description here

    这里可能出了什么问题?

    0 回复  |  直到 3 年前
    推荐文章