# OAuth2ClientCredentials

OAuth2 client identifier and secret registered with the identity provider (all vendors).

- Source: [`aws-bedrockagentcore/lib/identity/oauth2-credential-provider.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/identity/oauth2-credential-provider.ts#L244)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

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

declare const secretValue: cdk.SecretValue;
const oAuth2ClientCredentials: bedrockagentcore.OAuth2ClientCredentials = {
  clientId: 'clientId',
  clientSecret: secretValue,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_bedrockagentcore as bedrockagentcore

# secret_value: cdk.SecretValue

o_auth2_client_credentials = bedrockagentcore.OAuth2ClientCredentials(
    client_id="clientId",
    client_secret=secret_value
)
```

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.*;
import software.amazon.awscdk.services.bedrockagentcore.*;

SecretValue secretValue;

OAuth2ClientCredentials oAuth2ClientCredentials = OAuth2ClientCredentials.builder()
        .clientId("clientId")
        .clientSecret(secretValue)
        .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;
using Amazon.CDK.AWS.BedrockAgentCore;

SecretValue secretValue;

var oAuth2ClientCredentials = new OAuth2ClientCredentials {
    ClientId = "clientId",
    ClientSecret = secretValue
};
```

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 cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var secretValue SecretValue

oAuth2ClientCredentials := &OAuth2ClientCredentials{
	ClientId: jsii.String("clientId"),
	ClientSecret: secretValue,
}
```

## Properties

- `clientId`: string (required) — OAuth2 client identifier.

- `clientSecret`: [SecretValue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.SecretValue.html) (required) — OAuth2 client secret.

  **NOTE:** The client secret will be included in the CloudFormation template as part of synthesis.
  The service stores the secret in Secrets Manager after creation, but the value is visible
  in the template and deployment history. Use `SecretValue.unsafePlainText()` to explicitly
  acknowledge plaintext, or pass a reference from another construct to avoid embedding the
  literal value.
