Skip to content

CognitoUserPoolClient

Reference doc for the `sst.aws.CognitoUserPoolClient` component.

The CognitoUserPoolClient component is internally used by the CognitoUserPool component to add clients to your Amazon Cognito user pool.

You’ll find this component returned by the addClient method of the CognitoUserPool component.


Constructor

new CognitoUserPoolClient(name, args, opts?)

Parameters

Properties

id

Type Output<string>

The Cognito User Pool client ID.

nodes

Type Object

The underlying resources this component creates.

nodes.client

Type UserPoolClient

The Cognito User Pool client.

secret

Type Output<string>

The Cognito User Pool client secret.

SDK

Use the SDK in your runtime to interact with your infrastructure.


This is accessible through the Resource object in the SDK.

  • id string

    The Cognito User Pool client ID.

  • secret string

    The Cognito User Pool client secret.

Args

providers?

Type Input<Input<string>[]>

Default [“COGNITO”]

A list of identity providers that are supported for this client.

If you are using a federated identity provider.

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"
},
});

Make sure to pass in provider.providerName instead of hardcoding it to "MyProvider".

sst.config.ts
userPool.addClient("Web", {
providers: [provider.providerName]
});

This ensures the client is created after the provider.

transform?

Type Object

Transform how this component creates its underlying resources.

transform.client?

Type UserPoolClientArgs | (args: UserPoolClientArgs, opts: ComponentResourceOptions, name: string) => void

Transform the Cognito User Pool client resource.

userPool

Type Input<string>

The Cognito user pool ID.