AWS Cognito / Amplify - faça com que novas inscrições de usuários sejam adicionadas automaticamente a um grupo de usuários
Estou usando a biblioteca do AWS Amplify para se inscrever e executar o Auth para um projeto do AppSync. Isso usa o Cognito. No entanto, quando um novo usuário se inscreve no Amplify / Cognito, o novo usuário não é atribuído a nenhum grupo específico no pool de cognitos. Estou usando o componente de ordem superior do Amplify para fazer login / inscrição.
import { withAuthenticator } from 'aws-amplify-react';
que envolvo em um componente
class Authenticator extends React.Component {
//... basically empty component, only exists so I can wrap it w/ the HOC
}
export default withAuthenticator(Authenticator)
O Amplify está configurado no index.js
import config from './aws-exports';
import Amplify from 'aws-amplify';
Amplify.configure(config);
O aws-imports.js foi gerado automaticamente pela CLI do AWS Mobile Hub. Parece...
const awsmobile = {
'aws_app_analytics': 'enable',
'aws_cognito_identity_pool_id': 'us-west-2:XXX',
'aws_cognito_region': 'us-west-2',
'aws_content_delivery': 'enable',
'aws_content_delivery_bucket': 'flashcards-hosting-mobilehub-XXX',
'aws_content_delivery_bucket_region': 'us-west-2',
'aws_content_delivery_cloudfront': 'enable',
'aws_content_delivery_cloudfront_domain': 'XXX.cloudfront.net',
'aws_mandatory_sign_in': 'enable',
'aws_mobile_analytics_app_id': 'XXX',
'aws_mobile_analytics_app_region': 'us-east-1',
'aws_project_id': 'XXX',
'aws_project_name': 'flash-cards',
'aws_project_region': 'us-west-2',
'aws_resource_name_prefix': 'flashcards-mobilehub-XXX',
'aws_sign_in_enabled': 'enable',
'aws_user_pools': 'enable',
'aws_user_pools_id': 'us-west-2_XXX',
'aws_user_pools_mfa_type': 'OFF',
'aws_user_pools_web_client_id': 'XXX',
}
export default awsmobile;