如果我要登录或注册帐户,则会收到错误消息No Userpool
我构建了一个AwsService来设置配置并调用AwsFunction
配置
const devConfig = {
Auth: {
aws_appsync_graphqlEndpoint: 'https://someHash.appsync-api.eu-central-1.amazonaws.com/graphql',
aws_appsync_region: 'eu-central-1',
aws_appsync_authenticationType: 'AMAZON_COGNITO_USER_POOLS',
aws_appsync_apiKey: 'null',
},
}
首先,我触发AwsService.init,它使用Amplify.configure(config)
毕竟,我尝试连接以从Auth.signUp
呼叫aws-amplify
AwsService.js
import Amplify, { Auth } from 'aws-amplify'
class AwsService {
signUp ({ fullName, email, password }) {
Auth.signUp({
name: fullName,
email,
password,
})
.then(user => console.log('user', user))
.catch(err => console.log('err', err))
}
...
作为响应,我在错误函数中收到No Userpool
错误。
答案 0 :(得分:0)
将显示错误,因为从AWS生成的配置为false,并且需要其他参数。
正确的配置参数是:
const devConfig = {
Auth: {
identityPoolId: 'eu-central-1:somehash',
region: 'eu-central-1',
userPoolId: 'eu-central-1_Hash',
userPoolWebClientId: 'otherHash',
},
}