AWS Cognito:在 Auth.signIn 中出现错误(验证 amazon-cognito-identity-js 是不是已链接)
Posted
技术标签:
【中文标题】AWS Cognito:在 Auth.signIn 中出现错误(验证 amazon-cognito-identity-js 是不是已链接)【英文标题】:AWS Cognito: Getting error in Auth.signIn (Validate that amazon-cognito-identity-js has been linked)AWS Cognito:在 Auth.signIn 中出现错误(验证 amazon-cognito-identity-js 是否已链接) 【发布时间】:2021-05-31 14:16:47 【问题描述】:我是 Amplify 与 Cognito 集成的新手,并且正在开发一个使用 Amplify 和 Cognito 进行身份验证的 react-native 应用程序。我已经在 AWS 控制台中配置了用户池和联合身份。
我使用 react-navigation 5.x 版本创建了自己的注册和登录界面,并带有相应的屏幕。 下面是我在 package.json 中添加的 AWS 相关模块
"@aws-amplify/auth": "^3.4.24",
"@aws-amplify/core": "^3.8.16",
这是 App.js 中的 Amplify 配置
Amplify.configure(
Auth:
identityPoolId: 'eu-west-2:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
region: 'eu-west-2',
userPoolId: 'eu-west-2_xxxxxxxx',
userPoolWebClientId: 'xxxxxxxxxxxxxxxxxxxxxx',
authenticationFlowType: 'USER_PASSWORD_AUTH'
);
我能够成功调用 Auth.signUp,但是当我尝试调用 Auth.signIn(username, password )
验证 amazon-cognito-identity-js 是否已链接
如何才能成功调用 Auth.signIn,请帮忙解决问题?
【问题讨论】:
您需要安装amazon-cognito-identity-js
依赖项。
感谢它帮助解决。
【参考方案1】:
我遇到了同样的问题,我通过安装 cognito 身份来解决它。 运行以下命令:
npm i amazon-cognito-identity-js
安装后重新启动 rn
npm start
【讨论】:
请编辑您的问题并添加有关您的错误、日志和代码的更多信息。以上是关于AWS Cognito:在 Auth.signIn 中出现错误(验证 amazon-cognito-identity-js 是不是已链接)的主要内容,如果未能解决你的问题,请参考以下文章
如何确定用户是不是关闭了 google auth2.signIn() 窗口?
AWS Cognito:Cognito 用户池的元数据 URL 在哪里?