在大多数功能的所有 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没有帮助:
最佳答案
AWS 提供了一个 opaque implementation用于用户上下文数据。encodedData
将在设备上而不是服务器上收集。
Cognito Javascript client SDK公开了实现此目的的方法。它在 Amplify Android SDK 中提供
您可以获得转账encodedData
从客户端到服务器,然后在您的请求中将其转发到 Cognito。
关于php - 我应该使用什么作为 Cognito 的 UserContextData => EncodedData?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58186556/