【发布时间】:2018-02-21 03:58:16
【问题描述】:
我正在尝试为 AWS cognito 编写 node.js REST 包装器。我希望客户端提供一个deviceKey,Cognito 将使用它来检测用户是否从新设备登录。
我想知道如何获取客户端的deviceKey,并在尝试进行身份验证时提供自定义deviceKey。
类似于以下内容:
const AWS.getDeviceKey({
onSuccess: (deviceIdentifier) => deviceIdentifier
})
const authenticationDetails = new AuthenticationDetails({
Username: username,
Password: password,
DeviceKey: "client identifier string"
})
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: (result) => result
})
【问题讨论】:
-
我不知道如何在node.js环境中获取设备密钥,但我最近在浏览器环境中想通了。见stackoverflow.com/a/57290452/2300770也许这有助于找出node.js的解决方案。
标签: javascript amazon-web-services amazon-cognito