# AuthorizationMode

Interface to specify default or additional authorization(s).

- Source: [`aws-appsync/lib/graphqlapi.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi.ts#L25)
- Type last changed: v2.60.0 · 12 Jan 2023

## Example

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

const api = new appsync.GraphqlApi(this, 'api', {
  name: 'api',
  definition: appsync.Definition.fromFile('schema.graphql'),
  authorizationConfig: {
    defaultAuthorization: { authorizationType: appsync.AuthorizationType.IAM }
  },
});

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});

rule.addTarget(new targets.AppSync(api, {
  graphQLOperation: 'mutation Publish($message: String!){ publish(message: $message) { message } }',
  variables: events.RuleTargetInput.fromObject({
    message: 'hello world',
  }),
}));
```

## Properties

- `apiKeyConfig`: [ApiKeyConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.ApiKeyConfig.html) — If authorizationType is `AuthorizationType.API_KEY`, this option can be configured.

  **Default:** name: 'DefaultAPIKey' | description: 'Default API Key created by CDK'

- `authorizationType`: [AuthorizationType](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AuthorizationType.html) (required) = `AuthorizationType.API_KEY` — One of possible four values AppSync supports.

- `lambdaAuthorizerConfig`: [LambdaAuthorizerConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.LambdaAuthorizerConfig.html) = none — If authorizationType is `AuthorizationType.LAMBDA`, this option is required.

- `openIdConnectConfig`: [OpenIdConnectConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.OpenIdConnectConfig.html) = none — If authorizationType is `AuthorizationType.OIDC`, this option is required.

- `userPoolConfig`: [UserPoolConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.UserPoolConfig.html) = none — If authorizationType is `AuthorizationType.USER_POOL`, this option is required.
