# OAuth2AuthorizationServerMetadata

Struct · Stable

Static OAuth2 authorization server metadata for custom credential providers.

- 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#L431)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

```ts
agentcore.OAuth2CredentialProvider.usingCustom(this, "CustomOAuthMeta", {
  clientId: "your-client-id",
  clientSecret: cdk.SecretValue.unsafePlainText("your-client-secret"),
  authorizationServerMetadata: {
    issuer: "https://idp.example.com",
    authorizationEndpoint: "https://idp.example.com/oauth2/authorize",
    tokenEndpoint: "https://idp.example.com/oauth2/token",
  },
});
```

Python:

```python
agentcore.OAuth2CredentialProvider.using_custom(self, "CustomOAuthMeta",
    client_id="your-client-id",
    client_secret=cdk.SecretValue.unsafe_plain_text("your-client-secret"),
    authorization_server_metadata=agentcore.OAuth2AuthorizationServerMetadata(
        issuer="https://idp.example.com",
        authorization_endpoint="https://idp.example.com/oauth2/authorize",
        token_endpoint="https://idp.example.com/oauth2/token"
    )
)
```

Java:

```java
OAuth2CredentialProvider.usingCustom(this, "CustomOAuthMeta", CustomOAuth2CredentialProviderProps.builder()
        .clientId("your-client-id")
        .clientSecret(SecretValue.unsafePlainText("your-client-secret"))
        .authorizationServerMetadata(OAuth2AuthorizationServerMetadata.builder()
                .issuer("https://idp.example.com")
                .authorizationEndpoint("https://idp.example.com/oauth2/authorize")
                .tokenEndpoint("https://idp.example.com/oauth2/token")
                .build())
        .build());
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
OAuth2CredentialProvider.UsingCustom(this, "CustomOAuthMeta", new CustomOAuth2CredentialProviderProps {
    ClientId = "your-client-id",
    ClientSecret = SecretValue.UnsafePlainText("your-client-secret"),
    AuthorizationServerMetadata = new OAuth2AuthorizationServerMetadata {
        Issuer = "https://idp.example.com",
        AuthorizationEndpoint = "https://idp.example.com/oauth2/authorize",
        TokenEndpoint = "https://idp.example.com/oauth2/token"
    }
});
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
agentcore.OAuth2CredentialProvider_UsingCustom(this, jsii.String("CustomOAuthMeta"), &CustomOAuth2CredentialProviderProps{
	ClientId: jsii.String("your-client-id"),
	ClientSecret: cdk.SecretValue_UnsafePlainText(jsii.String("your-client-secret")),
	AuthorizationServerMetadata: &OAuth2AuthorizationServerMetadata{
		Issuer: jsii.String("https://idp.example.com"),
		AuthorizationEndpoint: jsii.String("https://idp.example.com/oauth2/authorize"),
		TokenEndpoint: jsii.String("https://idp.example.com/oauth2/token"),
	},
})
```

## Properties

- `authorizationEndpoint`: string (required) — The authorization endpoint URL.

- `issuer`: string (required) — The issuer URL for the OAuth2 authorization server.

- `responseTypes`: string[] — The supported response types.

  **Default:** not specified

- `tokenEndpoint`: string (required) — The token endpoint URL.
