# How to add the authorization in api gateway object

**URL:** <https://forum.serverless.com/t/how-to-add-the-authorization-in-api-gateway-object/18152>\
**Category:** Serverless Framework\
**Created:** [January 3, 2023, 5:15pm UTC](https://forum.serverless.com/t/how-to-add-the-authorization-in-api-gateway-object/18152 "2023-01-03T17:15:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veena](https://avatars.discourse-cdn.com/v4/letter/v/51bf81/32.png) [@Veena](https://forum.serverless.com/u/Veena)\
**Post date:** [January 3, 2023, 5:15pm UTC](https://forum.serverless.com/t/how-to-add-the-authorization-in-api-gateway-object/18152/1 "2023-01-03T17:15:21Z")

</div>

How to add authorization in the serverless.ts file as we do in serverless.yml file

Serverless.ts  
apiGateway: {  
minimumCompressionSize: 1024,  
shouldStartNameWithService: true,

```
    }

```

Serverless.yml

MyApi:  
Type: AWS::Serverless::Api  
Properties:  
StageName: dev  
Auth:  
DefaultAuthorizer: MyLambdaTokenAuthorizer  
Authorizers:  
MyLambdaTokenAuthorizer:  
FunctionArn: !GetAtt MyAuthFunction.Arn

Please help me out finding way to attach the lambda authorization.
