Ryan
11/22/2021, 12:01 PM// cognito stack
const userPoolClient = userPool.addClient('app-client', {
oAuth: {
callbackUrls: [frontendStack.url], // Can't inject this here because the static site isn't made yet
logoutUrls: [frontendStack.url],
}
});
const userPoolInstance = new sst.Auth(this, "Auth", {
cognito: {
userPool,
userPoolClient,
},
});
// frontend stack
const frontendSite = new sst.StaticSite(this, "frontend", {
environment: {
"COGNITO_LOGIN": cognitoStack.url // Need this in the constructor
}
}
I have to set those properties in the constructors. There isn't any way to add them afterwards as far as I can see.
Surely there is a way to get this working?
I can manually construct the user pool domain and pass that around rather than the pool itself, but I kind of like everything being auto-generated so I know it's always correct.
But would that be the best solution?
Maybe I could defer the creation of the Auth construct until the front-end is made, but then the backend stack (which depends on it) will come after the front-end... And I'm sure that is going to cause issues?
It feels like I should be able to set those redirect URLs (callback URLs) after the front-end, but I can't see how.Thomas Ankcorn
11/22/2021, 12:38 PMRyan
11/22/2021, 1:51 PMThomas Ankcorn
11/22/2021, 2:22 PMthdxr
11/22/2021, 3:41 PMthdxr
11/22/2021, 3:41 PMRyan
11/23/2021, 1:09 AMRyan
11/23/2021, 1:18 AMRyan
11/23/2021, 8:38 AMThomas Ankcorn
11/23/2021, 9:38 AMRyan
11/23/2021, 10:06 AMRyan
11/23/2021, 11:18 AMThomas Ankcorn
11/23/2021, 11:19 AMRyan
11/23/2021, 11:21 AMRyan
11/23/2021, 1:12 PMUserPoolClient
, you get an IUserPoolClient
.
The sst.Auth
construct only accepts UserPoolClient
.
Is there any reason why the sst.Auth
construct can't work with IUserPoolClient
?
Then I could basically create the user pool client in a script and import it.Ryan
11/23/2021, 1:15 PM