小编dyn*_*amo的帖子

AWS Cognito 自定义身份验证流程-initiateAuth 给出错误

我正在尝试使用 AWS Cognito 创建自定义身份验证流程,以便我可以通过电子邮件而不是通过 Cognito 触发器发送 MFA 代码。我正在使用 initiateAuth() 方法来执行此操作,根据文档,这是正确的;

https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#initiateAuth -财产

我的有效负载似乎有效,但当我尝试使用用户登录时,出现错误“t.getauthparameters 不是函数”

我浏览了其他一些 stackoverflow 帖子,但没有任何帮助

有什么想法出了什么问题吗?

这是我的代码片段如下:


const payload = {
          AuthFlow: 'CUSTOM_AUTH',
          ClientId: 'my client id', 
          AuthParameters: {
             USERNAME: $('input[name=username]').val(),
             PASSWORD: $('input[name=password]').val(),
             CHALLENGE_NAME: 'SRP_A'
          }
        };
        
        cognitoUser.initiateAuth(payload, {
            onSuccess: function(result) {
                // User authentication was successful
            },
            onFailure: function(err) {
                // User authentication was not successful
            },
            customChallenge: function(challengeParameters) {
                // User authentication depends on challenge response
                var verificationCode = prompt('Please input OTP code' ,'');
                cognitoUser.sendCustomChallengeAnswer(verificationCode, …
Run Code Online (Sandbox Code Playgroud)

javascript frontend amazon-web-services amazon-cognito amazon-cognito-triggers

3
推荐指数
1
解决办法
2821
查看次数