Cognito confirmDevice - 给定的设备密钥无效的响应

0

【以下的问题经过翻译处理】 我在完成 MFA(服务器端)后确认用户的设备,以确保我们能够让他们调用刷新(由于用户池上的设备跟踪,我们需要此操作)。 但是,我尝试的所有结果都会导致相同的结果 - Invalid device key given。 由于 aws-cognito-identity-js,我们让它在客户端运行良好,甚至无需尝试 - 但我们还有一个旧应用程序的旧登录端点,我们希望将其挂接到新用户池中,因此刷新调用需要 deviceKey。 我一直在查看 aws-cognito-identity-js 发出的调用,这些调用在浏览器中成功 - 但当我复制为curl并在终端中运行时失败 - 是的,你得到了Invalid device key given。 我的代码如下 - accessToken 和 deviceKey 来自 SMS_MFA 挑战的响应结果 - 有人通过 aws-cognito-identity-js 解决这个问题吗? ''' authHelper.generateHashDevice(deviceGroupKey, deviceKey, async (err) => { if (err) { return reject(err); }

            const deviceSecretVerifierConfig = {
                Salt: Buffer.from(
                    authHelper.getSaltDevices(),
                    'hex'
                ).toString('base64'),
                PasswordVerifier: Buffer.from(
                    authHelper.getVerifierDevices(),
                    'hex'
                ).toString('base64'),
            };

            const confirmConfig = {
                AccessToken: accessToken,
                DeviceKey: deviceKey,
                DeviceName: `${username}-${poolId}-${deviceKey}`,
                DeviceSecretVerifierConfig: deviceSecretVerifierConfig,
            }
        
            await cognito.confirmDevice(confirmConfig);
        });

'''

profile picture
专家
已提问 5 个月前26 查看次数
1 回答
0

【以下的回答经过翻译处理】 你好, 当未使用 USER_SRP_AUTH [1] 时,通常会出现'Invalid device key given' 错误。 请确保您正在使用 USER_SRP_AUTH 。 您可以参考以下文章来了解设备跟踪和记住的完整流程。 [+] https://aws.amazon.com/premiumsupport/knowledge-center/cognito-user-pool-remembered-devices/

如果您仍然面临这个问题,我建议您提出一个案例并提供支持以进行深入研究。 请使用以下链接向 AWS 创建支持案例 -

[+] https://console.aws.amazon.com/support/home#/case/create

参考

[1] https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html#Built-in-authentication-flow-and-challenges

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则