in SST, i know that we can use `auth.attachPermiss...
# help
e
in SST, i know that we can use
auth.attachPermissionsForAuthUsers([api]);
when creating the sst.Auth() constructor. but what if i want to reference an existing already provisioned cognito userpool?
a
Not sure but you could check if this works :-
Copy code
const awesomePool = cognito.UserPool.fromUserPoolId(this, 'awesome-user-pool', 'us-east-1_oiuR12Abd');

new Auth(this, "Auth", {
  cognito: {
    userPool: {
      userPool: awesomePool,
    },
  },
});
you’ll need to import cognito as such :-
Copy code
import { aws_cognito as cognito } from 'aws-cdk-lib';
I’m assuming you’re on sst version > 0.59.0
f
Actually currently u can’t pass an existing user pool into
Auth
. @Ernie Francis are you blocked by this? Let me know and I will add support for it.
a
oh, it’d be great to have this. I would be needing this when I begin switching to cognito from auth0.
e
@Frank it does make attaching permissions to the sst.API instance difficult.
for my current stack, i made a Cognito userpool via the AWS console vs the CDK or sst.Auth constructor
f
Got it guys. I will take a crack at this and release tonite.
Hey guys, you can now import existing User Pools in v0.66.0. Here’s an example https://docs.serverless-stack.com/constructs/Auth#importing-an-existing-user-pool
a
@Frank is it in any relevant to be able to import an existing identity pool as well? I don’t know and so I’m asking.
f
Ah yeah.. that makes sense. Lemme know when u need to do that, I will put it in.
a
Sure, thank you, that’d be great. 😁🙏