问题
I used amplify add auth
that works fine and then amplify push
.
The React website is running without a problem. But when I try to register or login, I get the error [ERROR] AuthClass - Cannot get the current user because the user pool is missing. Please make sure the Auth module is configured with a valid Cognito User Pool ID
.
But the aws_user_pools_id
is the same like in the id in the aws console.
Have someone an idea what the problem could be?
thanks ;)
Thats my App.js with no magic...
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);
回答1:
I had faced a similar issue with aws and to overcome I simply created a new user pool after which I was able to log in and register.
回答2:
The Problem was, that you have to add the configure method as well:
import Amplify from 'aws-amplify';
import aws_exports from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react';
Amplify.configure(aws_exports);
回答3:
I had to do the following and it worked.
amplify push
amplify publish
After that, the No userPool
error went away and I was sent a confirmation code, received it in email, and then used that to confirm my account. Then I was able to login.
来源:https://stackoverflow.com/questions/54349873/no-user-pool-when-try-to-request-cognito