When I create a new cognito user pool, I would like to create more than one user pool client, but I can’t find a way of doing it…
Here is my actual code:
Resources:
CognitoUserPool:
Type: AWS::Cognito::UserPool
Properties:
# Generate a name based on the stage
UserPoolName: ${self:provider.stage}-blablabla
# Set email as an alias
UsernameAttributes:
- email
AutoVerifiedAttributes:
- email
CognitoUserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
# Generate an app client name based on the stage
ClientName: Bla
UserPoolId:
Ref: CognitoUserPool
ExplicitAuthFlows:
- ADMIN_NO_SRP_AUTH
GenerateSecret: true
If I try to duplicate the block “CognitoUserPoolClient”, I get an error YAMLException: duplicated mapping key
You were on the right track duplicating the CognitoUserPoolClient, you just have to make the 2nd copy have a different name. such as:
CognitoUserPoolClient2:
Type: AWS::Cognito::UserPoolClient
Properties:
# Generate an app client name based on the stage
ClientName: Bla2
UserPoolId:
Ref: CognitoUserPool
ExplicitAuthFlows:
- ADMIN_NO_SRP_AUTH
GenerateSecret: true