boto3:无法为用户设置MFA启用设置

时间:2018-10-05 18:01:44

标签: boto3 mfa

我有一个启用了可选MFA的用户池。我正在尝试使用以下代码为用户启用MFA(使用SMS),如果他/她提供了电话号码

                self.cognitoClient.admin_create_user(
                UserPoolId=self.userPoolID,
                Username=userID,
                TemporaryPassword=temporaryPassword,
                UserAttributes=userAttributes,
                DesiredDeliveryMediums=desiredDeliveryMediums
            )
            if len(phoneNumber) != 0:
                response = self.cognitoClient.admin_set_user_mfa_preference(
                    SMSMfaSettings={
                        'Enabled': True,
                        'PreferredMfa': True
                    },
                    UserPoolId=self.userPoolID,
                    Username=userID,
                )
                print str(response)
            #self.createTenantInTenantMgr(userID, tenantID, phoneNumber)
        except Exception as e:
            print "Failed to create user " + str(e)
            sys.exit(0)

但是,当我在cognito控制台上检查时,它没有启用它。

我正在使用boto3的1.9.17版本。这是一个已知问题吗?

0 个答案:

没有答案
相关问题