尝试请求认知访问时没有用户池 [英] No User Pool when try to request cognito

查看:78
本文介绍了尝试请求认知访问时没有用户池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 amplify add auth 正常工作,然后 amplify push
React网站运行没有问题。但是,当我尝试注册或登录时,出现错误 [ERROR] AuthClass-无法获得当前用户,因为缺少用户池。请确保为Auth模块配置了有效的Cognito用户池ID
但是 aws_user_pools_id 与aws控制台中的id相同。
有人知道可能是什么问题吗?
谢谢;)

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 ;)

多数民众赞成在我的App.js中没有魔术...

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);

推荐答案

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

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);

这篇关于尝试请求认知访问时没有用户池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆