https://serverless-stack.com/ logo
#help
Title
# help
d

Daniel Gato

02/08/2022, 1:16 PM
I’m looking for a way to set a custom Attribute on the Auth construct with some default value. Any examples on that around?
f

Frank

02/08/2022, 5:53 PM
@Daniel Gato are you looking to set custom attributes on the user pool?
Something like this should work
Copy code
new Auth(this, "Auth", {
  cognito: {
    userPool: {
      customAttributes: {
        'joinedOn': new cognito.DateTimeAttribute(),
      },
    },
  },
});
d

Daniel Gato

02/09/2022, 7:25 AM
Thank you. Do you know a way to give it a default value?
f

Frank

02/09/2022, 7:26 AM
hmm.. don’t think so… it seems only possible to do it in application code https://stackoverflow.com/questions/47875257/how-to-set-default-values-for-user-attributes-in-aws-cognito
d

Daniel Gato

02/09/2022, 9:51 AM
Then I will set a some trigger for that. thanks