amazon-cognito - response-to-auth-challenge 返回错误:提供的会话无效
问题描述
夏天的
我将尝试为创建的用户设置新密码admin-create-user
。
$ aws cognito-idp admin-create-user \
--user-pool-id ap-northeast-1_xxxxxxxx \
--username test@example.com \
--user-attributes \
Name=email,Value=test@example.com \
Name=email_verified,Value=True \
Name=given_name,Value=hoge \
Name=family_name,Value=fuga \
Name=custom:hoge,Value=fuga
当我第一次登录时,NEW_PASSWORD_REQUIRED
是必需的。
$ aws cognito-idp initiate-auth \
--client-id client-id-xxxx \
--auth-flow USER_PASSWORD_AUTH \
--auth-parameters \
USERNAME=test@example.com,PASSWORD=xxxxxxxx
{
"ChallengeName": "NEW_PASSWORD_REQUIRED",
"Session": "session"
"ChallengeParameters": {
"USER_ID_FOR_SRP": "session-xxxxx",
"requiredAttributes": "[]",
"userAttributes": "{\"email_verified\":\"True\",\"custom:department\":\"
}
}
所以我打电话respond-to-auth-challenge
来解决NEW_PASSWORD_REQUIRED
状态。
但即使我设置了由initiate-auth
.
$ aws cognito-idp respond-to-auth-challenge \
--client-id client-id-xxxx \
--challenge-responses "NEW_PASSWORD=Password1234,USERNAME=test@example.com" \
--challenge-name NEW_PASSWORD_REQUIRED \
--session session-xxxxx
An error occurred (CodeMismatchException) when calling the RespondToAuthChallenge operation: Invalid session provided
我想知道如何解决这个错误。
(※我调用initiate-auth
and respond-to-auth-challenge
,不是admin-xxx
因为它应该被客户端应用程序调用。)
解决方案
抱歉这个问题已经解决了。
这仅仅是因为会话太长而我的终端没有显示完整的会话。
所以我将输出写入文件。
aws cognito-idp initiate-auth \
--client-id 3hnanmnckc1b7lejgs1m8supri \
--auth-flow USER_PASSWORD_AUTH \
--auth-parameters \
USERNAME=sekiguchi@mmmcorp.co.jp,PASSWORD=wancZJiw6@ >> cognito_initiate-auth.txt
推荐阅读
- django - Django雇主雇员关系
- matlab - 在 Matlab 中写入文件的命名约定错误
- matlab - 通过前置/后置 NaN 对齐单元阵列中的多个阵列
- html - 用html删除多余的空格
- c - GCC 扩展程序集 pin 局部变量到除 r12 之外的任何寄存器
- flutter - 如何更改容器在堆栈中的位置?
- c# - Ajax 响应未在源代码中显示
- javascript - 等待 executeScript 完成
- django - mod_wsgi.Input 对象没有属性流错误
- django - 如何使用 redis 作为消息代理正确设置生产者 - 消费者方案并将结果存储在 postgresql / sqlite 中?