Missing Feature - UserPool client configuration (Callback URLs and scopes)
See original GitHub issueAbility to configure a Cognito User Pool Clients including callback URLs, signout URLs, and allowed scopes.
-
I’m submitting a …
- 🪲 bug report
- 🚀 feature request
- 📚 construct library gap
- ☎️ security issue or vulnerability => Please see policy
- ❓ support request => Please see note at the top of this template.
-
What is the current behavior? Can create UserPools and UserPool clients, however the configuration of the client is very limited. Can only specify clientName, enabledAuthFlows, and whether to create a secret or not.
-
What is the expected behavior (or behavior of feature suggested)? Would also like to be able to configure callback URLs, signout URLs, and allowed scopes so a complete functional UserPool can be created from scratch.
-
What is the motivation / use case for changing the behavior or adding this feature? Ability to create an ApiGateway secured by a cognito userpool with specific callback URLs and available scopes.
-
Please tell us about your environment:
- CDK CLI Version: 0.34.0
- OS: Windows 10 | Debian Stretch
- Language: TypeScript
-
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc) Currently I am creating the userpool like below, I believe this to be correct but please tell me if this is the wrong way to go about this?
const userPool = new cognito.UserPool(this, "userPool", {
autoVerifiedAttributes: [],
poolName: "userPool",
signInType: cognito.SignInType.Username,
usernameAliasAttributes: [
cognito.UserPoolAttribute.Email,
cognito.UserPoolAttribute.PhoneNumber
]
});
const userPoolClient = new cognito.UserPoolClient(
this,
"userPoolClient",
{
clientName: "Client",
enabledAuthFlows: [
cognito.AuthFlow.AdminNoSrp,
cognito.AuthFlow.CustomFlowOnly
],
userPool: userPool
}
);
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:19 (6 by maintainers)
Top GitHub Comments
From the CloudFormation documentation on UserPoolClient I would expect CloudFormation to support callback and logout URLS. Not sure if this was added recently by the CloudFormation team, but I thought it would be useful to post it here.
So this means that for now you could use the
Cfn
escape hatch as long as not all features in the CDK classes are implemented. Something like this gives you an idea:Be aware of the ‘strange’ capitalizing of the
callbackUrLs
andlogoutUrLs
methods.I did give it a run with CDK 1.9.0 and it seemed to create the UserPoolClient with the callback URL just fine for me.
As a followup to @dveijck’s post above replying to @misterjoshua; CDK has a really short/convenient syntax for custom resources that just need to call AWS SDK functions:
A basic example (untested for this use case exactly) derived from some similar code I wrote recently: