import Amplify, { Auth } from 'aws-amplify';
import awsConfig from './aws-exports';
Amplify.configure(awsConfig);
Auth.configure(awsConfig);
const awsmobile = {
"aws_project_region": "YOUR_REGION",
"aws_cognito_identity_pool_id": "YOUR_IDENTITY_POOL_ID",
"aws_cognito_region": "YOUR_REGION",
"aws_user_pools_id": "YOUR_USER_POOLS_ID",
"aws_user_pools_web_client_id": "YOUR_USER_POOLS_WEB_CLIENT_ID",
"oauth": {},
"aws_appsync_graphqlEndpoint": "YOUR_APPSYNC_GRAPHQL_ENDPOINT",
"aws_appsync_region": "YOUR_REGION",
"aws_appsync_authenticationType": "API_KEY"
};
export default awsmobile;
import Amplify, { Auth } from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);
Auth.signUp({
username,
password,
attributes: {
email, // optional
phone_number, // optional - E.164 number convention
// other custom attributes
},
validationData: [] //optional
})
如果以上步骤仍然无法解决该问题,请检查您的AWS IAM角色和策略,以确保它们正确地配置和配置API调用。