Que*_*yot 8 php amazon-web-services amazon-cognito aws-sdk
在大多数功能的所有 AWS Cognito 开发工具包中,您可以传递一个UserContextData参数来提供 Cognito 的高级安全功能:
$result = $client->forgotPassword([
'AnalyticsMetadata' => [
'AnalyticsEndpointId' => '<string>',
],
'ClientId' => '<string>', // REQUIRED
'SecretHash' => '<string>',
'UserContextData' => [ // <=================== THIS
'EncodedData' => '<string>',
],
'Username' => '<string>', // REQUIRED
]);
Run Code Online (Sandbox Code Playgroud)
该领域需要一些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
],
[...]
]);
Run Code Online (Sandbox Code Playgroud)
该文档没有帮助:

AWS 为用户上下文数据提供了不透明的实现。
encodedData将在设备而不是服务器上收集。
Cognito Javascript 客户端 SDK公开了一种方法来实现此目的。它在Amplify Android SDK中提供
您可以encodedData从客户端到服务器进行传输,然后将其在请求中转发到 Cognito。