For configuring Cognito, which one should be used?...
# help
ö
For configuring Cognito, which one should be used? 1.
Copy code
new Auth(this, "Auth", {
  cognito: { signInAliases: { email: true } },
});
2.
Copy code
new Auth(this, "Auth", {
  cognito: {
    userPool: {
      signInAliases: { email: true, phone: true },
    },
  },
});
There are examples for both of them in the documentation. The upgrading to v0.12.0 section ( https://docs.serverless-stack.com/constructs/Auth#upgrading-to-v0120 ) suggests to use the second one, but I’m not sure what that version corresponds to.
a
the second one has worked for me recently
ö
I see thanks.
a
where did you find the first version? never seen this
j
also curious about setting up Cognito with SST
a
hmm, it shows both ways on that same page
maybe both work?
i did it following the tutorial app construction, which uses the second version, and it worked
ö
Yes right
Do you know if I can set different permissions for authenticated users?
a
if you look in Auth.d.ts, it seems like both should work. It's probably a short form
yeah, you can, there are both
attachPermissionsForAuthUsers
and
attachPermissionsForUnauthUsers
methods on Auth object
ö
But for different roles
😄
f
@Ömer Toraman @Adrian Schweizer sorry for the confusion guys. #2 is right:
Copy code
new Auth(this, "Auth", {
  cognito: {
    userPool: {
      signInAliases: { email: true, phone: true },
    },
  },
});
Just updated the doc.