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
EXPERTE
gefragt vor 6 Monaten33 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor 6 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen