Tobias T
05/09/2022, 9:20 AM| CREATE_IN_PROGRESS | AWS::Cognito::UserPool | AuthUserPool8115E87F | Resource creation Initiated
| CREATE_COMPLETE | AWS::Cognito::UserPool | AuthUserPool8115E87F
| CREATE_IN_PROGRESS | AWS::Cognito::UserPool | UserPool6BA7E5F2 | Resource creation Initiated
| CREATE_COMPLETE | AWS::Cognito::UserPool | UserPool6BA7E5F2
My stack looks like this:
import * as cognito from "aws-cdk-lib/aws-cognito";
import { Auth, StackContext } from "@serverless-stack/resources";
export function AuthStack({ stack }: StackContext) {
// Userpool
const userPool = new cognito.UserPool(stack, "UserPool", {
selfSignUpEnabled: true,
signInAliases: { email: true },
signInCaseSensitive: false,
});
// Userpool client
const userPoolClient = new cognito.UserPoolClient(stack, "UserPoolClient", {
userPool,
authFlows: { userPassword: true },
});
const auth = new Auth(stack, "Auth", {
login: ["email"],
});
return {
auth,
userPool,
userPoolClient,
};
}
Danny
05/09/2022, 10:44 AMAuth
creates its own pool, you can probably supply your custom pool as configuration option to it?Tobias T
05/09/2022, 11:31 AMTobias T
05/09/2022, 12:30 PMconst auth = new Auth(stack, "Auth", {
login: ["email"],
cdk: {
userPool: {
selfSignUpEnabled: true,
signInAliases: { email: true },
signInCaseSensitive: false,
},
userPoolClient: {
authFlows: { userPassword: true },
},
},
});
Frank
Frank
signInAliases
, it’s set by login
.
• don’t need selfSignUpEnabled
, default is true
• don’t need signInCaseSensitive
, default is false
So this should work
const auth = new Auth(stack, "Auth", {
login: ["email"],
cdk: {
userPoolClient: {
authFlows: { userPassword: true },
},
},
});
Tobias T
05/10/2022, 6:32 AM