# CustomOAuth2CredentialProviderProps

Props for {@link OAuth2CredentialProvider.usingCustom}.

Set exactly one of {@link discoveryUrl} (OIDC discovery document) or {@link authorizationServerMetadata}
(static OAuth2 server metadata). Do not pass both.

Extends: CustomOAuth2CredentialProviderProps
Extends: OAuth2CredentialProviderFactoryBaseProps

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

## Example

```ts
agentcore.OAuth2CredentialProvider.usingCustom(this, "CustomOAuth", {
  oAuth2CredentialProviderName: "custom-idp",
  clientId: "your-client-id",
  clientSecret: cdk.SecretValue.unsafePlainText("your-client-secret"),
  discoveryUrl: "https://idp.example.com/.well-known/openid-configuration",
});
```

## Properties

- `authorizationServerMetadata`: [OAuth2AuthorizationServerMetadata](/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.OAuth2AuthorizationServerMetadata.html) — Authorization server metadata (issuer, authorization and token endpoints) when not using a discovery URL.

  **Default:** not used when {@link discoveryUrl } is set

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

- `clientSecret`: [SecretValue](/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.

- `discoveryUrl`: string — OIDC/OAuth2 discovery document URL for dynamic integration with the identity provider.

  **Default:** not used when {@link authorizationServerMetadata } is set

- `oAuth2CredentialProviderName`: string — Name of the credential provider.

  **Default:** a name generated by CDK

- `tags`: { [key: string]: string } — Tags for this credential provider.

  **Default:** no tags
