# EventApiAuthConfig

Authorization configuration for the Event API.

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

## Example

```ts
import * as logs from 'aws-cdk-lib/aws-logs';

const apiKeyProvider: appsync.AppSyncAuthProvider = {
  authorizationType: appsync.AppSyncAuthorizationType.API_KEY,
};

const api = new appsync.EventApi(this, 'api', {
  apiName: 'Api',
  ownerContact: 'OwnerContact',
  authorizationConfig: {
    authProviders: [
      apiKeyProvider,
    ],
    connectionAuthModeTypes: [
      appsync.AppSyncAuthorizationType.API_KEY,
    ],
    defaultPublishAuthModeTypes: [
      appsync.AppSyncAuthorizationType.API_KEY,
    ],
    defaultSubscribeAuthModeTypes: [
      appsync.AppSyncAuthorizationType.API_KEY,
    ],
  },
  logConfig: {
    fieldLogLevel: appsync.AppSyncFieldLogLevel.INFO,
    retention: logs.RetentionDays.ONE_WEEK,
  },
});

api.addChannelNamespace('default');
```

## Properties

- `authProviders`: [AppSyncAuthProvider](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncAuthProvider.html)[] — Auth providers for use in connection, publish, and subscribe operations.

  **Default:** API Key authorization

- `connectionAuthModeTypes`: [AppSyncAuthorizationType](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncAuthorizationType.html)[] — Connection auth modes.

  **Default:** API Key authorization

- `defaultPublishAuthModeTypes`: [AppSyncAuthorizationType](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncAuthorizationType.html)[] — Default publish auth modes.

  **Default:** API Key authorization

- `defaultSubscribeAuthModeTypes`: [AppSyncAuthorizationType](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncAuthorizationType.html)[] — Default subscribe auth modes.

  **Default:** API Key authorization
