Vue AWS Amplify无法获取凭证

问题描述 投票:0回答:1

我正在使用AWS Amplify在Vue应用程序中进行身份验证。

我能够成功登录,但是无法使用Auth.currentUserCredentials()和Auth.currentCredentials()获得凭据。

我将很乐意帮助您解决问题。

我使用Amplify的Hub事件侦听器侦听授权事件的auth通道,并调试记录器。

登录后,我注意到了这一点:

enter image description here

此程序在开发人员模式下运行,但如果在网站上构建并运行,则会出现完全相同的错误。

似乎对本地主机的POST引起了问题。但是为什么在运行生产版本时会调用localhost?

这是从登录到调用Auth.currentCredentials()之后的整个日志:

enter image description here

enter image description here

这是登录表单的代码:

<amplify-authenticator>
  <div>
    My App
    <amplify-sign-out></amplify-sign-out>
  </div>
</amplify-authenticator>

这是我的aws-exports.js文件:

const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_cognito_identity_pool_id": "eu-west-1:xyz....-4144-4b70-b021-e3486dbb1d43",
"aws_cognito_region": "eu-west-1",
"aws_user_pools_id": "eu-west-1_xyz....",
"aws_user_pools_web_client_id": "xyz....",
"oauth": {}

};

导出默认的awsmobile;

amazon-web-services vue.js authentication credentials aws-amplify
1个回答
0
投票

似乎已经修复了一个错误,因此现在可以工作

© www.soinside.com 2019 - 2024. All rights reserved.