amazon-web-services - 如何启用认知用户 MFA

标签 amazon-web-services api go sdk amazon-cognito

我在打电话时遇到了一个问题

enableMFAStatus, err := cogIProv.AdminSetUserMFAPreferenceWithContext(ctx, &cip.AdminSetUserMFAPreferenceInput{
    UserPoolId: aws.String(userPoolID),
    Username:   aws.String(username),
    SMSMfaSettings: &cip.SMSMfaSettingsType{
        Enabled:      aws.Bool(enableMFA),
        PreferredMfa: aws.Bool(true),
    },
})

它对成功响应没有任何作用。是否有其他方法可以为 cognito 用户池用户启用 SMS MFA?

最佳答案

只有两个 API 调用可以为 Cognito 用户池中的用户启用/禁用 MFA:

  • SetUserMFAPreference[a]
  • AdminSetUserMFAPreference[b]

正如官方 AWS API 文档中所述,这两个 API 调用都不会返回任何响应 JSON,如果 API 调用执行时没有任何错误,将会有一个空的 HTTP 200 响应。 为了测试和理解 API 的行为,我建议 Cognito 用户先通过 AWS CLI 测试它们,然后再在所选编程语言的 SDK 中使用它们。

引用资料

[一个]。 https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SetUserMFAPreference.html

[b]。 https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminSetUserMFAPreference.html

关于amazon-web-services - 如何启用认知用户 MFA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52699133/

相关文章:

java - AWS S3 查询字符串请求身份验证备选上传文件

reactjs - React Hook useEffect : fetch data using axios with async await . api 调用连续相同的 api

ruby-on-rails - 点击 Google Contacts API 时出现 "connection reset by peer"错误

go - Ginkgo 测试在 goapp 测试期间挂起

import - 有没有办法稍后在golang中导入?

amazon-web-services - AWS-SDK : SQS How identify messages that were not deleted in BatchDeleteOperation

tomcat - 在 Amazons Elastic Beanstalk 上部署 WAR

node.js - NodeJs : Exiftool can not be spawned in AWS Lambda environment

javascript - 如何为我页面的 Javascript 提供 Greasemonkey 的 GM_xmlhttpRequest 的有限接口(interface)?

git - go-git等效于“git push --all <remote>”