# AuthorizationType

enum with all possible values for AppSync authorization type.

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

## Example

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

const api = appsync.GraphqlApi.fromGraphqlApiAttributes(this, 'ImportedAPI', {
  graphqlApiId: '<api-id>',
  graphqlApiArn: '<api-arn>',
  graphQLEndpointArn: '<api-endpoint-arn>',
  visibility: appsync.Visibility.GLOBAL,
  modes: [appsync.AuthorizationType.IAM],
});

const rule = new events.Rule(this, 'Rule', { schedule: events.Schedule.rate(cdk.Duration.minutes(1)), });
const role = new iam.Role(this, 'Role', { assumedBy: new iam.ServicePrincipal('events.amazonaws.com') });

// allow EventBridge to use the `publish` mutation
api.grantMutation(role, 'publish');

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

## Members

| Member | Description |
| --- | --- |
| `API_KEY` | API Key authorization type. |
| `IAM` | AWS IAM authorization type. |
| `USER_POOL` | Cognito User Pool authorization type. |
| `OIDC` | OpenID Connect authorization type. |
| `LAMBDA` | Lambda authorization type. |

## Referenced by

- [`AuthorizationMode`](/v2/docs/aws-cdk-lib.aws_appsync.AuthorizationMode).authorizationType
- [`GraphqlApi`](/v2/docs/aws-cdk-lib.aws_appsync.GraphqlApi).modes
- [`GraphqlApiAttributes`](/v2/docs/aws-cdk-lib.aws_appsync.GraphqlApiAttributes).modes
- [`GraphqlApiBase`](/v2/docs/aws-cdk-lib.aws_appsync.GraphqlApiBase).modes
- [`IGraphqlApi`](/v2/docs/aws-cdk-lib.aws_appsync.IGraphqlApi).modes
