From 734edb08f0e52bd323eb1c15b8414e9e9d4b3ecd Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 20 Sep 2024 14:36:27 -0400 Subject: [PATCH] cognito: update tsdoc --- .../src/components/aws/cognito-user-pool.ts | 43 +++++++++++++++---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/platform/src/components/aws/cognito-user-pool.ts b/platform/src/components/aws/cognito-user-pool.ts index 15fd2b92a..663c74acb 100644 --- a/platform/src/components/aws/cognito-user-pool.ts +++ b/platform/src/components/aws/cognito-user-pool.ts @@ -528,17 +528,17 @@ export class CognitoUserPool extends Component implements Link.Linkable { triggers.customEmailSender === undefined ? undefined : { - lambdaArn: createTrigger("customEmailSender")!, - lambdaVersion: "V1_0", - }, + lambdaArn: createTrigger("customEmailSender")!, + lambdaVersion: "V1_0", + }, customMessage: createTrigger("customMessage"), customSmsSender: triggers.customSmsSender === undefined ? undefined : { - lambdaArn: createTrigger("customSmsSender")!, - lambdaVersion: "V1_0", - }, + lambdaArn: createTrigger("customSmsSender")!, + lambdaVersion: "V1_0", + }, defineAuthChallenge: createTrigger("defineAuthChallenge"), postAuthentication: createTrigger("postAuthentication"), postConfirmation: createTrigger("postConfirmation"), @@ -548,9 +548,9 @@ export class CognitoUserPool extends Component implements Link.Linkable { triggers.preTokenGeneration === undefined ? undefined : { - lambdaArn: createTrigger("preTokenGeneration")!, - lambdaVersion: triggers.preTokenGenerationVersion, - }, + lambdaArn: createTrigger("preTokenGeneration")!, + lambdaVersion: triggers.preTokenGenerationVersion, + }, userMigration: createTrigger("userMigration"), verifyAuthChallengeResponse: createTrigger( "verifyAuthChallengeResponse", @@ -627,6 +627,31 @@ export class CognitoUserPool extends Component implements Link.Linkable { * ```ts * userPool.addClient("Web"); * ``` + * + * And if you are using an identity provider. + * + * ```js title="sst.config.ts" + * const provider = userPool.addIdentityProvider("MyProvider", { + * type: "oidc", + * details: { + * authorize_scopes: "email profile", + * client_id: "your-client-id", + * client_secret: "your-client-secret" + * }, + * }); + * ``` + * :::tip + * Don't hardcode the provider name. Reference it from the `providerName` property. + * ::: + * + * Make sure to pass in the provider's `providerName` instead of hardcoding it. This + * ensures the client is created after the provider. + * + * ```ts + * userPool.addClient("Web", { + * providers: [provider.providerName] + * }); + * ``` */ public addClient(name: string, args?: CognitoUserPoolClientArgs) { // Note: Referencing an existing client will be implemented in the future: