- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个 Cognito 用户池,用户可以在其中注册,但无法再登录。我尝试了许多不同的配置,例如禁用 MFA、关闭设备内存(据我所知可能会导致此问题),但均无济于事。
最奇怪的是,它在本地运行良好(localhost:5000
)。我可以创建帐户并登录,没有任何戏剧性,但是当我尝试在我的网站 https://example.com
(托管在 S3 上)上登录时,它会抛出上述错误。如果我注册的话,用户实际上似乎也是在 Cognito 中创建的 - 这样就可以了,但登录除了在本地以外的任何地方都不起作用。
我对每个设置、环境变量、重新创建用户池等进行了两次、三次检查。
错误
这是我尝试登录时抛出的不明确错误:
{
__type: "NotAuthorizedException",
message: "Incorrect username or password."
}
预注册触发 lambda
我在用户通过 lambda 注册之前对其进行确认:
import {INTERNAL_SERVER_ERROR} from 'http-status-codes';
export async function validateHumanViaSns(
event: CognitoUserPoolTriggerEvent,
context: Context,
callback: Callback
): Promise<CognitoUserPoolTriggerHandler> {
try {
event.response.autoConfirmUser = true;
callback(null, event);
return;
} catch (error) {
console.error(error);
callback(null, new Response(INTERNAL_SERVER_ERROR, {message: 'Something went wrong'}));
return;
}
}
package.json
我的客户正在使用最新的 amplify-js图书馆。
dependencies: {
"amplify": "1.1.19" // broken since 1.1.18
}
CloudFormation Cognito 模板
UserPool:
Type: 'AWS::Cognito::UserPool'
Properties:
UserPoolName: myapp-${self:provider.stage}-user-pool
SmsVerificationMessage: 'Your verification code is {####}.'
AutoVerifiedAttributes:
- email
MfaConfiguration: 'OFF'
EmailVerificationSubject: 'Your MyApp verification code'
EmailVerificationMessage: 'Your MyApp verification code is {####}.'
SmsAuthenticationMessage: 'Your MyApp authentication code is {####}.'
Schema:
- Name: name
AttributeDataType: String
Mutable: true
Required: false
- Name: email
AttributeDataType: String
Mutable: false
Required: false
- Name: phone_number
AttributeDataType: String
Mutable: true
Required: false
Policies:
PasswordPolicy:
RequireLowercase: true
RequireSymbols: false
RequireNumbers: true
MinimumLength: 8
RequireUppercase: true
AdminCreateUserConfig:
InviteMessageTemplate:
EmailMessage: 'Your MyApp username is {username} and temporary password is {####}.'
EmailSubject: 'Your temporary MyApp password'
SMSMessage: 'Your MyApp username is {username} and temporary password is {####}.'
UnusedAccountValidityDays: 7
AllowAdminCreateUserOnly: false
# Creates a User Pool Client to be used by the identity pool
UserPoolClient:
Type: 'AWS::Cognito::UserPoolClient'
Properties:
ClientName: myapp-${self:provider.stage}-web-client
GenerateSecret: false
UserPoolId:
Ref: UserPool
# Creates a federeated Identity pool
IdentityPool:
Type: 'AWS::Cognito::IdentityPool'
Properties:
IdentityPoolName: MyApp{self:provider.stage}Identity
AllowUnauthenticatedIdentities: true
CognitoIdentityProviders:
- ClientId:
Ref: UserPoolClient
ProviderName:
'Fn::GetAtt': [ UserPool, ProviderName ]
# Create a role for unauthorized access to AWS resources. Very limited access. Only allows users in the previously created Identity Pool
CognitoUnAuthorizedRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Principal:
Federated: 'cognito-identity.amazonaws.com '
Action:
- 'sts:AssumeRoleWithWebIdentity'
Condition:
StringEquals:
'cognito-identity.amazonaws.com :aud':
Ref: IdentityPool
'ForAnyValue:StringLike':
'cognito-identity.amazonaws.com :amr': unauthenticated
Policies:
- PolicyName: 'CognitoUnauthorizedPolicy'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'mobileanalytics:PutEvents'
- 'cognito-sync:*'
Resource: '*'
# Create a role for authorized access to AWS resources. Control what your user can access. This example only allows Lambda invokation
# Only allows users in the previously created Identity Pool
CognitoAuthorizedRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Principal:
Federated: 'cognito-identity.amazonaws.com '
Action:
- 'sts:AssumeRoleWithWebIdentity'
Condition:
StringEquals:
'cognito-identity.amazonaws.com :aud':
Ref: IdentityPool
'ForAnyValue:StringLike':
'cognito-identity.amazonaws.com :amr': authenticated
Policies:
- PolicyName: 'CognitoAuthorizedPolicy'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'mobileanalytics:PutEvents'
- 'cognito-sync:*'
- 'cognito-identity:*'
Resource: '*'
- Effect: 'Allow'
Action:
- 'lambda:InvokeFunction'
Resource: '*'
# Assigns the roles to the Identity Pool
IdentityPoolRoleMapping:
Type: 'AWS::Cognito::IdentityPoolRoleAttachment'
Properties:
IdentityPoolId:
Ref: IdentityPool
Roles:
authenticated:
'Fn::GetAtt': [ CognitoAuthorizedRole, Arn ]
unauthenticated:
'Fn::GetAtt': [ CognitoUnAuthorizedRole, Arn ]
有谁知道为什么会抛出这个特定的错误(我认为这是误导性的),或者更好的是,如何解决这个问题?
最佳答案
此问题已在 AWS Amplify Github 问题积压中修复,more context here .
无论在哪里导入 amplify,都需要事先直接导入 crypto-js
依赖项,因为 amplify-js 库中存在 Typescript 编译问题:
import 'crypto-js/lib-typedarrays'; // add this line
import Amplify, {Auth} from 'aws-amplify';
看起来这将是 future 拉取请求中的永久修复,因此根据您登陆此处的时间,尝试将aws-amplify
包更新为某些内容>首先1.1.19
,看看是否已经在主包中修复了。
关于amazon-web-services - 用户登录时登录抛出 'Incorrect username or password' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54188428/
我在 Controller 中有此功能,但我无法重置密码,因为我想将字符长度更改为 5 位数字。 public function postReset(Request $request) { $th
我正在学习使用 maven password encryption能力,我想知道如何选择参数 .有两件事我不明白: 1) mvn --encrypt-master-password foobar总会给
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关闭 9 年前。 这个问题似乎不是关于 a specific programming problem,
我想知道其他电子商务/行业网站上“忘记密码”流程的“标准”使用率是多少?目前,没有多少人会访问我网站上的“忘记密码”链接,但这主要是因为大多数人没有密码。我正在安装新的登录名(这将鼓励人们创建密码),
从存储库中提取源代码需要我的密码。 SourceTree 默认记住此密码。我不希望 SourceTree 记住我的密码。我每次都必须禁用此功能! 如何禁用此默认行为?谢谢! 最佳答案 我在 Mac 上
这个问题已经有答案了: When to use single quotes, double quotes, and backticks in MySQL (13 个回答) 已关闭 5 年前。 Erro
我正在为我的 iOS 应用程序使用 Firebase 身份验证服务。我想通过电子邮件或谷歌登录提供商登录应用程序。我申请了firebase instractions . 我可以使用电子邮件和密码登录。
我正在尝试了解角色密码在 Postgres 中的运作方式。 https://www.postgresql.org/docs/current/static/sql-createrole.html表示加密
为什么“确认密码和密码相同”部分不起作用?意思是,使用“getElementById”来处理密码和确认密码的部分。每个部分都有效,但特定部分除外。它不会在文本字段周围显示红色框。谁能帮我吗?
我遇到了 Flutter 的 TextInputType 没有密码类型的问题: /// All possible enum values. static const List values = con
我正在尝试使用 Azure 应用服务创建应用程序。 但是,它显示上述错误:无法识别的参数: 我使用的命令是 --> az ad app create --available-to-other-tena
我正在尝试使用 Azure 应用服务创建应用程序。 但是,它显示上述错误:无法识别的参数: 我使用的命令是 --> az ad app create --available-to-other-tena
我有(数千个)包含各种(数十亿)行的 csv 文件,例如: 组合.csv example0@domain.tld:passw0rd ex.a.m-pl_e1@domain.tld;p@££w0r46&
在我的 Spring 3 MVC 应用程序中,用户需要保存密码,如果他们也能够在保存时确认密码,那将是一个不错的功能。 在 bean 中,我使用基于注释的验证。是否有注释 validator 可用于执
我在 pgsql 中创建了一个没有密码的新用户。但是当我尝试为这个用户创建一个数据库时,它提示输入密码 >createuser -d -S -R -U postgres test1 Password:
我创建了 Form 这种形式的小部件有多个 TextFormFeild 我创建了自定义 BoxFeild .我面临与 相关的问题auto-validation 来自表单小部件。无法验证确认密码中的密码
在 SQL Server 2008 R2 标准版上,每当我尝试通过报表管理器更新数据源凭据时,我都无法保存更改,因为它会报告消息 "The password is not valid. Please
我有一个用 JAVA 编写并部署在 Wildfly 8.2 上的小型 REST 应用程序。当我尝试使用 javax 安全库登录时,出现错误 FailedLoginException: Password
验证错误:子“密码”失败,因为运行测试时显示[“密码”是必需的]错误 我使用 hapijs v17.2.3 和 mongodb 作为后端。我正在尝试使用 lab 和 code 执行单元测试。这是我的t
我使用 visual studio 2010 创建了一个登录表单,其中包含用户名的输入文本和 userpass 的密码类型输入。我有最新的 chrome 版本 59.0.3071.115(官方构建)(
我是一名优秀的程序员,十分优秀!