# AppSyncCognitoConfig

Configuration for Cognito user-pools in AppSync for Api.

- Source: [`aws-appsync/lib/auth-config.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/auth-config.ts#L71)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
import { aws_cognito as cognito } from 'aws-cdk-lib';

declare const userPool: cognito.UserPool;
const appSyncCognitoConfig: appsync.AppSyncCognitoConfig = {
  userPool: userPool,

  // the properties below are optional
  appIdClientRegex: 'appIdClientRegex',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync
from aws_cdk import aws_cognito as cognito

# user_pool: cognito.UserPool

app_sync_cognito_config = appsync.AppSyncCognitoConfig(
    user_pool=user_pool,

    # the properties below are optional
    app_id_client_regex="appIdClientRegex"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;
import software.amazon.awscdk.services.cognito.*;

UserPool userPool;

AppSyncCognitoConfig appSyncCognitoConfig = AppSyncCognitoConfig.builder()
        .userPool(userPool)

        // the properties below are optional
        .appIdClientRegex("appIdClientRegex")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;
using Amazon.CDK.AWS.Cognito;

UserPool userPool;

var appSyncCognitoConfig = new AppSyncCognitoConfig {
    UserPool = userPool,

    // the properties below are optional
    AppIdClientRegex = "appIdClientRegex"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var userPool UserPool

appSyncCognitoConfig := &AppSyncCognitoConfig{
	UserPool: userPool,

	// the properties below are optional
	AppIdClientRegex: jsii.String("appIdClientRegex"),
}
```

## Properties

- `appIdClientRegex`: string = None — the optional app id regex.

- `userPool`: [IUserPool](/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.IUserPool.html) (required) — The Cognito user pool to use as identity source.
