小编Sag*_*hah的帖子

React 和 AWS Amplify - 用户没有设置用于打开 SMS_MFA 的交付配置

我有一个 React Web 应用程序(利用 aws-amplify),它连接到 AWS Cognito 用户池进行身份验证。

我的应用程序的用户可以选择从设置中启用 SMS MFA。

我尝试使用aws amplify npm 包启用 SMS MFA ,但遇到错误

{
  "__type": "InvalidParameterException",
  "message": "User does not have delivery config set to turn on SMS_MFA"
}
Run Code Online (Sandbox Code Playgroud)

我已在 AWS Cognito 用户池设置中将 MFA 设置为“可选”,如下面的屏幕截图所示。

在此输入图像描述

这是我的组件逻辑

import React, { useState, useEffect } from 'react';
import { Card, Grid, Typography, Box, Switch } from '@material-ui/core';
import { Auth } from 'aws-amplify';

const Profile = () => {
  const [currentUser, setCurrentUser] = useState(null);

  // use …
Run Code Online (Sandbox Code Playgroud)

sms reactjs amazon-cognito aws-amplify multi-factor-authentication

5
推荐指数
1
解决办法
7242
查看次数