php - 我应该使用什么作为 Cognito 的 UserContextData => EncodedData?

标签 php amazon-web-services aws-sdk amazon-cognito

在大多数功能的所有 AWS Cognito 开发工具包中,您可以传递 UserContextData用于提供 Cognito 高级安全功能的参数:

$result = $client->forgotPassword([
  'AnalyticsMetadata' => [
    'AnalyticsEndpointId' => '<string>',
  ],
  'ClientId' => '<string>', // REQUIRED
  'SecretHash' => '<string>',
  'UserContextData' => [  // <=================== THIS
    'EncodedData' => '<string>',
  ],
  'Username' => '<string>', // REQUIRED
]);  

此字段需要一些 EncodedData .

我应该放什么UserContextData以及如何“编码”它?

使用 Admin* 时函数如 AdminInitiateAuth我可以通过 ContextData 发送未编码的指纹数据:
$result = $client->adminInitiateAuth([
    [...]
    'ContextData' => [
        'EncodedData' => '<string>',
        'HttpHeaders' => [ // REQUIRED
            [
                'headerName' => '<string>',
                'headerValue' => '<string>',
            ],
            // ...
        ],
        'IpAddress' => '<string>', // REQUIRED
        'ServerName' => '<string>', // REQUIRED
        'ServerPath' => '<string>', // REQUIRED
    ],
    [...]
]);

documentation没有帮助:
enter image description here

最佳答案

AWS 提供了一个 opaque implementation用于用户上下文数据。
encodedData将在设备上而不是服务器上收集。

Cognito Javascript client SDK公开了实现此目的的方法。它在 Amplify Android SDK 中提供

您可以获得转账encodedData从客户端到服务器,然后在您的请求中将其转发到 Cognito。

关于php - 我应该使用什么作为 Cognito 的 UserContextData => EncodedData?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58186556/

相关文章:

php - 拉维尔 5.2 : How to get the role of current user when using `Zizaco/entrust` ?

Python/Boto + AWS S3 版本控制 : how do I replace the current key with older version?

amazon-web-services - 如何在AWS中自动删除超过1个月的 Elasticsearch 记录

python - Django 无法在 AWS Elastic Beanstalk 负载均衡环境中获取用户 IP

amazon-web-services - AWS如何让ASG始终使用最新的AMI?

php - MySQL查询字符串错误

php - 搜索 mysql 数据库并从 php 和 html 中的结果创建链接

javascript - 我应该为不同的设备单独制作 "responding script"吗?

node.js - 您应该为应用程序用户使用 AWS IAM 角色和权限吗?

kotlin - 如何在 Kotlin 中将数据类转换为 ByteBuffer?