gpt4 book ai didi

reactjs - 尝试请求 cognito 时没有用户池

转载 作者:行者123 更新时间:2023-12-05 00:59:16 25 4
gpt4 key购买 nike

我使用 amplify add auth 效果很好,然后使用 amplify push。React 网站运行没有问题。但是当我尝试注册或登录时,我收到错误 [ERROR] AuthClass - Cannot get the current user because the user pool is missing。请确保为 Auth 模块配置了有效的 Cognito 用户池 ID。但是 aws_user_pools_id 与 aws 控制台中的 id 相同。有人知道问题可能是什么吗?谢谢;)

那是我的 App.js 没有魔法......

import React, { Component } from 'react';
import './App.css';
import HomeScreen from './screens/HomeScreen';
import { withAuthenticator } from 'aws-amplify-react';

class App extends Component {
render() {
return (
<div className="App">
<HomeScreen />
</div>
);
}
}

export default withAuthenticator(App);

最佳答案

问题是,您还必须添加配置方法:

import Amplify from 'aws-amplify';
import aws_exports from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react';
Amplify.configure(aws_exports);

关于reactjs - 尝试请求 cognito 时没有用户池,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54349873/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com