【问题标题】:AWS Cognito - get user by phone numberAWS Cognito - 通过电话号码获取用户
【发布时间】:2018-11-01 15:18:41
【问题描述】:

我正在尝试实现一个返回给定用户电子邮件的函数,我想知道是否有办法通过电话号码找到 Cognito 用户?

【问题讨论】:

标签: ios amazon-web-services aws-cognito


【解决方案1】:

您可以使用ListUsers API

请求语法:

{
    "AttributesToGet": [email],
    "Filter": "phone_number ^= \"+1123-456-7890\"",
    "Limit": 1,
    "UserPoolId": "us-west-2_samplepool"
}

iOS SDK中,您可以使用AWSCognitoIdentityProviderListUsersRequest请求类。

let getUsersRequest = AWSCognitoIdentityProviderListUsersRequest()

getUsersRequest?.attributesToGet = ["email"]
getUsersRequest?.userPoolId = "MyAWSCognitoUserPoolId"
getUsersRequest?.filter = "phone_number ^= \"+1123-456-7890\""

AWSCognitoIdentityProvider(forKey: AWSCognitoUserPoolId).listUsers(getUsersRequest!, completionHandler: { (response, error) in

})

例如,您可以查看我们的tests 之一。

【讨论】:

  • 您好!我现在也有类似的问题。为了使用 AWSCognitoIdentityProviderListUsersRequest(),您需要什么 pod(然后导入)?这是我的帖子:stackoverflow.com/questions/56416551/…
  • AWSCognitoIdentityProvider
猜你喜欢
  • 1970-01-01
  • 2021-09-11
  • 1970-01-01
  • 1970-01-01
  • 2012-07-09
  • 2020-04-22
  • 2016-01-07
  • 2017-02-18
  • 2013-03-02
相关资源
最近更新 更多