Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AWS放大验证器UI确认登录错误_Javascript_Reactjs_Amazon Web Services_Amazon Cognito_Aws Amplify - Fatal编程技术网

Javascript AWS放大验证器UI确认登录错误

Javascript AWS放大验证器UI确认登录错误,javascript,reactjs,amazon-web-services,amazon-cognito,aws-amplify,Javascript,Reactjs,Amazon Web Services,Amazon Cognito,Aws Amplify,我正在使用AWS Amplify Authenticator UI组件进行登录、短信验证等 我可以注册,没有MFA也可以注册。当我启用SMS MFA时,“AmplificConfirmSignin”组件会要求输入SMS代码,但输入代码后会抛出以下错误 Uncaught (in promise) TypeError: Cannot read property 'challengeName' of undefined 下面是我的代码 { authState !== 'signedin' ?

我正在使用AWS Amplify Authenticator UI组件进行登录、短信验证等

我可以注册,没有MFA也可以注册。当我启用SMS MFA时,“AmplificConfirmSignin”组件会要求输入SMS代码,但输入代码后会抛出以下错误

Uncaught (in promise) TypeError: Cannot read property 'challengeName' of undefined
下面是我的代码

{ authState !== 'signedin' ?
    <AmplifyAuthenticator usernameAlias="email" amplifyConfig={awsconfig} >
    <div slot="sign-in" className="amplifyCont">
      <AmplifySignIn slot="sign-in" usernameAlias="email" />
      </div>
      <div slot="sign-up" className="amplifyCont">
      <AmplifySignUp
        slot="sign-up"
        usernameAlias="email"
        formFields={[
          {
            type: "name",
            label: "First Name",
            placeholder: "John",
            required: true,
          },
          {
            type: "family_name",
            key: "family_name",
            label: "Last Name",
            placeholder: "Doe",
            required: true,
          },
          {
            type: "email",
            label: "Email Address",
            placeholder: "email@sample.com",
            required: true,
          },
          {
            type: "password",
            label: "Password",
            placeholder: "Password with both cases, symbol and number",
            required: true,
          },
          {
            type: "phone_number",
            label: "Phone Number",
            placeholder: "Primary Contact",
            required: false,
          },
        ]}
      />
      </div>
      <div slot="forgot-password" className="amplifyCont">
      <AmplifyForgotPassword slot="forgot-password" />
      </div>
      <div slot="require-new-password" className="amplifyCont">
      <AmplifyRequireNewPassword slot="require-new-password" />
      </div>
      <div slot="confirm-sign-in" className="amplifyCont" >
      <AmplifyConfirmSignIn slot="confirm-sign-in" />
      </div>
      
      </AmplifyAuthenticator>
      :
      <div className="App">
{authState!=='signedin'?
:

我搜索了Authenticator文档和google,但找不到解决方案。请帮助我。

我找到了解决方案,我们需要为确认登录组件提供“用户”属性

我通过onAuthUIStateChange处理程序获得了登录用户的详细信息

 React.useEffect(() => {
return onAuthUIStateChange((nextAuthState, authData) => {
   setUserVal(authData);
});}, []);

我想出了一个解决方案,我们需要为确认登录组件提供“user”属性

我通过onAuthUIStateChange处理程序获得了登录用户的详细信息

 React.useEffect(() => {
return onAuthUIStateChange((nextAuthState, authData) => {
   setUserVal(authData);
});}, []);