-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue creating custom attributes/modifying default attributes #93
Comments
Hey Andy, I’m away from my machine at the moment so I can’t dig in much
now. I’ll be back in a couple of days.
How are you verifying that the attributes aren’t saving? As far as I can
remember, the create user pool call should just save whatever you send to
it. I’m wondering if the create isn’t working or if it’s some other call
which isn’t respecting the attributes? Can you see the attributes in the
JSON file in .cognito/db ?
On Tue, 4 Jan 2022 at 2:21 pm, Andy Zawada ***@***.***> wrote:
Hello,
I am trying to create a user pool via the AWS CLI with some custom
attributes. My custom attribute JSON looks like this:
...
"Schema": [
{
"Name": "sub",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": true,
"Mutable": false,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "1",
"MaxLength": "100"
}
},
{
"Name": "userId",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "100"
}
},
{
"Name": "userType",
"AttributeDataType": "String",
"DeveloperOnlyAttribute": false,
"Mutable": true,
"Required": false,
"StringAttributeConstraints": {
"MinLength": "0",
"MaxLength": "100"
}
}
]
...
When I run
aws --endpoint http://localhost:9229 cognito-idp create-user-pool --pool-name my-user-pool --cli-input-json="$USER_POOL_JSON"
The default "sub" attribute is untouched and the custom attrs are not
present. I also tried the custom attrs with the prefix custom: but this
did not work as well. I tried tracing down the source of the issue but
couldn't figure out where exactly I was going wrong. Any advice would be
appreciated.
—
Reply to this email directly, view it on GitHub
<#93>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACUTARNR4UAOTZU222RSTUUJRTHANCNFSM5LGPOVBA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
James Gregory
Tel: 0411619513
Website: http://jagregory.com
Twitter: @jagregory <http://twitter.com/jagregory>
|
I can tell that the attributes are not saving because when I create a user pool using I think it might have something to do with the fact that the JSON to create the user pool calls the attributes field |
In the |
Ah, yes it’s likely the difference between the request and response formats
then.
If you’re feeling ambitious you could have a look at the
targets/createUserPool.ts file which you should see just spreads the req
object when creating the pool. Otherwise I’ll take a look when I’m back.
On Wed, 5 Jan 2022 at 3:46 pm, Andy Zawada ***@***.***> wrote:
In the .cognito/db folder, looking at the JSON for the user pool, I see
Schema and SchemaAttributes. When using the --schema flag it also doesn't
work.
—
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAACUTCXJ2CU4XOZMROOVODUUPEKBANCNFSM5LGPOVBA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
James Gregory
Tel: 0411619513
Website: http://jagregory.com
Twitter: @jagregory <http://twitter.com/jagregory>
|
I've been poking around in the There's most likely a better way to do this, but I can open a PR if you want. |
## [3.13.2](v3.13.1...v3.13.2) (2022-01-15) ### Bug Fixes * **api:** createUserPool saves SchemaAttributes ([3301878](3301878)), closes [#93](#93)
🎉 This issue has been resolved in version 3.13.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I stepped away from this for a few days but thanks for a quick response! |
# 1.0.0 (2024-05-13) ### Bug Fixes * add openid-configuration endpoint ([14a6507](14a6507)) * adminCreateUser correct response ([26aa5a7](26aa5a7)), closes [jagregory#38](https://github.com/michaelruocco/cognito-local/issues/38) * **api:** adminCreateUser defaults status to FORCE_CHANGE_PASSWORD ([4996aa4](4996aa4)) * **api:** adminCreateUser handles duplicate users ([7529971](7529971)) * **api:** adminDeleteUser handles email usernames ([8faa78f](8faa78f)), closes [jagregory#99](https://github.com/michaelruocco/cognito-local/issues/99) * **api:** confirm user apis return errors for invalid states ([e2975f0](e2975f0)) * **api:** createUserPool saves SchemaAttributes ([3301878](3301878)), closes [jagregory#93](https://github.com/michaelruocco/cognito-local/issues/93) * **api:** finish implementation of changePassword ([f649bfa](f649bfa)) * **api:** initiateAuth throws when missing AuthParameters ([d1eb240](d1eb240)) * **api:** respondToAuthChallenge throws if missing ChallengeResponses ([5e5aa36](5e5aa36)) * **api:** save attribute code separately from confirmation code ([b18af6a](b18af6a)) * **api:** users can be queried by their sub ([ae555b8](ae555b8)) * **api:** verifyUserAttributes throws CodeMismatchError ([b3b116c](b3b116c)) * auth_time resolution in generated tokens ([f300df4](f300df4)) * **build:** publish npm packages ([faaf12b](faaf12b)) * cache data stores to fix potential race condition ([406599a](406599a)) * change UserPoolId to Id in user pool storage ([71f5e52](71f5e52)) * **config:** arrays in config couldn't be overwritten ([7526a0a](7526a0a)) * confirmation ode from 4-digit to 6-digit ([jagregory#194](https://github.com/michaelruocco/cognito-local/issues/194)) ([e2053fe](e2053fe)) * conflation of a user's Sub and their Username ([ece63b6](ece63b6)) * **deps:** fix breaking change in stormdb ([dbed898](dbed898)) * **errorFormat:** make exception format more consistent with real Cognito exceptions ([e67576b](e67576b)) * hide debug logging by default ([48de4e5](48de4e5)) * imported json files weren't being published to npm ([5f76d86](5f76d86)) * include groups in tokens ([46e9445](46e9445)), closes [jagregory#176](https://github.com/michaelruocco/cognito-local/issues/176) * include groups in tokens ([996dcde](996dcde)), closes [jagregory#176](https://github.com/michaelruocco/cognito-local/issues/176) * incorrect case in import ([dd2538b](dd2538b)) * **InitiateAuth:** handle UNCONFIRMED user login attempt ([93a452b](93a452b)) * **initiateAuth:** invoke post auth lambda before generating tokens ([8330a9f](8330a9f)), closes [jagregory#281](https://github.com/michaelruocco/cognito-local/issues/281) * **initiateAuth:** invoke post auth lambda before generating tokens [281] ([8c06e2a](8c06e2a)) * **initiateAuth:** invoke post auth lambda before generating tokens [281] ([1b16f04](1b16f04)) * **jwt:** sign tokens with real rsa key ([949d3fc](949d3fc)) * key setting in the datastore to work with arrays ([d0a2557](d0a2557)) * lambda tests to use imported aws-sdk version ([d4a5c82](d4a5c82)) * **lambda:** customMessage uses code and username parameters ([084c253](084c253)) * **lambda:** forgotPassword invokes CustomMessage lambda ([79f43ef](79f43ef)) * **lambda:** invoke lambda with actual AWS SDK version ([bed1b7c](bed1b7c)) * **lambda:** lambda triggers called with clientMetadata/validationData ([2399c3e](2399c3e)) * **lambda:** preTokenGenerator can't change reserved claims ([407122f](407122f)) * **lambda:** save attributes from user migration lambda on user record ([dc7a1c6](dc7a1c6)) * **lambda:** unhandled errors in lambda return correct error message ([c9821d1](c9821d1)) * **log:** errors not being logged correctly ([1ca2b99](1ca2b99)) * propagate Session parameter through initiateAuth ([688fd4a](688fd4a)) * regression for usernames with full stops in ([73cb644](73cb644)), closes [jagregory#35](https://github.com/michaelruocco/cognito-local/issues/35) * **release:** reorder semantic-release plugins to commit last ([3a94c03](3a94c03)) * **release:** trigger a release for 1.0.0 ([5d8ba83](5d8ba83)) * runnable via npx ([4313ebf](4313ebf)), closes [jagregory#34](https://github.com/michaelruocco/cognito-local/issues/34) * **server:** better default handling for HOST and PORT ([69b4648](69b4648)) * **server:** ensure configured port and hostname are used for issuer and jwks urls ([95ec2cf](95ec2cf)) * **tests:** newer node versions were starting express in ipv6 ([efc08a7](efc08a7)) * **tokens:** add jti to id and refresh tokens ([4f475ad](4f475ad)) * **tokens:** adminInitateAuth uses token IssuerDomain ([37ba1c5](37ba1c5)) * **tokens:** id token not using issuer config ([c488810](c488810)) * updating a user pool updates cached options ([dc2b10e](dc2b10e)) * use username from user migration response ([0bb8d95](0bb8d95)) * use username from user migration response ([afe2372](afe2372)) * **userpool:** force save sub as attribute, fix sub check logic ([e5ed247](e5ed247)) * year out of range ([bc1fb6f](bc1fb6f)), closes [jagregory#40](https://github.com/michaelruocco/cognito-local/issues/40) ### Features * add more admin features and change password ([6339917](6339917)) * add support for admin commands ([b65a5bf](b65a5bf)) * **api:** adds endpoint for generating auth tokens ([31f46ca](31f46ca)) * **api:** adminConfirmSignUp full support ([e16a211](e16a211)) * **api:** adminCreateUser can generate a temporary password ([c0eea4f](c0eea4f)) * **api:** adminCreateUser delivers welcome message ([d49aa80](d49aa80)) * **api:** adminDeleteUser full support ([58f33e2](58f33e2)) * **api:** adminDeleteUserAttributes full support ([1a47086](1a47086)) * **api:** adminGetUser full support ([a6fc4c8](a6fc4c8)) * **api:** adminSetUserPassword support ([1707257](1707257)) * **api:** adminUpdateUserAttributes full support ([d3c5ebe](d3c5ebe)) * **api:** basic listUsers support ([6e0c18f](6e0c18f)) * **api:** createGroup support ([c3dc092](c3dc092)) * **api:** createUserPool full support ([e5c08dc](e5c08dc)) * **api:** deleteUser full support ([0a753b2](0a753b2)) * **api:** deleteUserAttributes full support ([3d0e9a0](3d0e9a0)) * **api:** describeUserPoolClient support ([26cf370](26cf370)) * **api:** full support for groups ([1fc025c](1fc025c)) * **api:** getUserAttributeVerificationCode full support ([90726a4](90726a4)) * **api:** initiateAuth handles FORCE_CHANGE_PASSWORD ([6703ea9](6703ea9)) * **api:** listGroups support ([252ee96](252ee96)) * **api:** listUserPools full support ([d2e5324](d2e5324)) * **api:** listUsers support for Filter ([5ebcf24](5ebcf24)), closes [jagregory#313](https://github.com/michaelruocco/cognito-local/issues/313) * **api:** respondToAuthChallenge support ([842633e](842633e)) * **api:** respondToAuthChallenge supports NEW_PASSWORD_REQUIRED ([6a75fea](6a75fea)) * **api:** signUp delivers message using auto verified attributes ([64280e8](64280e8)) * **api:** sms_mfa support for initiateAuth ([f16afe6](f16afe6)) * **api:** support for addCustomAttribute ([7932176](7932176)) * **api:** support for CustomEmailSender ([5da5c7c](5da5c7c)) * **api:** support for CustomEmailSender ([8dcaf10](8dcaf10)) * **api:** support for DeleteUserPool ([9dd6f2d](9dd6f2d)) * **api:** support for DeleteUserPoolClient ([f5bca87](f5bca87)) * **api:** support for ListUserPoolClients ([6e546ce](6e546ce)) * **api:** support for UpdateUserPoolClient ([4fa9de5](4fa9de5)) * **api:** updateUserAttributes full support ([308c9c2](308c9c2)) * **api:** updateUserPool and describeUserPool support ([fc62e8f](fc62e8f)) * **api:** verifyUserAttribute full support ([320dd17](320dd17)) * config file support ([ad0f247](ad0f247)) * confirm forgot password flow ([51df572](51df572)) * **confirmationCodes:** add CODE environment variable to pre-define the confirmation codes ([2c823f0](2c823f0)) * **confirmationCodes:** update README file ([9143469](9143469)) * createUserPoolClient support ([df421d7](df421d7)) * **docker:** publish arm64 images ([df0033b](df0033b)) * **docker:** publish arm64 images (again) ([c1361b8](c1361b8)) * forgot password flow ([6bd0b42](6bd0b42)) * include user attributes in user migration lambda call ([dabed92](dabed92)) * **jwt:** expose jwk endpoint to support verifying tokens ([bc27b86](bc27b86)) * **lambda:** initial user migration trigger support ([2f9ecfc](2f9ecfc)) * **lambda:** limited CustomMessage lambda support ([6880a90](6880a90)) * **lambda:** post authentication lambda support ([b75ca6b](b75ca6b)) * **lambda:** post confirmation lambda trigger ([f30573b](f30573b)) * **lambda:** postConfirmation called in signUp ([ddb2b77](ddb2b77)) * **lambda:** preSignUp trigger support in signUp ([af955a1](af955a1)) * **lambda:** preTokenGeneration trigger called when tokens generated ([d04506e](d04506e)) * **lambda:** support for CustomMessage_Authentication ([dfb6fdf](dfb6fdf)) * **lambda:** support for CustomMessage_SignUp ([ce69ea7](ce69ea7)) * **server:** add hostname option ([0365f3a](0365f3a)) * store clients for user pools ([eaad662](eaad662)) * support configurable expiration for tokens ([bae6da5](bae6da5)), closes [jagregory#220](https://github.com/michaelruocco/cognito-local/issues/220) * support configurable expiration for tokens ([675fab5](675fab5)), closes [jagregory#220](https://github.com/michaelruocco/cognito-local/issues/220) * support for adminEnable/DisableUser ([3b20f82](3b20f82)) * support for adminEnable/DisableUser ([462af6e](462af6e)) * support for GetUser api ([cc8048b](cc8048b)) * support getUserPoolMfaConfig ([416ea1d](416ea1d)) * suppress send welcome message ([12e7af8](12e7af8)) * **token:** add refresh token, revoke token and initiate auth ([0d46ed7](0d46ed7)) * **token:** initiateAuth basic refresh token support ([2d6b0e3](2d6b0e3)) ### BREAKING CHANGES * potential -- the autogenerated Sub and user-supplied Username were treated interchangeably before, but now are independent. Previously lookups by the Sub attribute were possible, but it now doesn't appear necessary so has been removed. Databases should be unaffected. * client ids are now validated and associated with specific user pools. * Nit pick of a breaking change, make the user pool database representation match what AWS reponds with from the API; keeping consistent with their response format should make it easier for us to implement APIs later. Sorry for the breakage. Migration steps: 1. Open any database json files and rename the UserPoolId key to Id
Hello,
I am trying to create a user pool via the AWS CLI with some custom attributes. My custom attribute JSON looks like this:
When I run
The default "sub" attribute is untouched and the custom attrs are not present. I also tried the custom attrs with the prefix
custom:
but this did not work as well. I tried tracing down the source of the issue but couldn't figure out where exactly I was going wrong. Any advice would be appreciated.The text was updated successfully, but these errors were encountered: