# Configure Authenticator for REST API

**URL:** <https://forum.serverless.com/t/configure-authenticator-for-rest-api/11524>\
**Category:** Serverless Framework\
**Tags:** aws, api-gateway\
**Created:** [May 22, 2020, 1:11pm UTC](https://forum.serverless.com/t/configure-authenticator-for-rest-api/11524 "2020-05-22T13:11:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OmniByte](https://avatars.discourse-cdn.com/v4/letter/o/e95f7d/32.png) [@OmniByte](https://forum.serverless.com/u/OmniByte)\
**Post date:** [May 22, 2020, 1:11pm UTC](https://forum.serverless.com/t/configure-authenticator-for-rest-api/11524/1 "2020-05-22T13:11:48Z")

</div>

I am trying to configure an authorizer for my REST API but something just isn’t right. I followed the instructions of a [SO post](https://stackoverflow.com/questions/41664708/cognito-user-pool-authorizer-with-serverless-framework) that instructed to do it like so:

```auto
functions:
  RequestUnicorn:
      handler: src/backend/requestUnicorn.handler
      events:
       - http:
            path: /rides  
            method: post    
            cors: true
            integration: lambda
            authorizer:
              name: wildrydez
              arn: arn:aws:cognito-idp:eu-central-1:183224933160:userpool/eu-central-1_HkrGy1GOi

```

I double-checked the arn of the pool after I deployed the app though no Authorizer is visible in the API Gateway  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/0/04540c21766cfed944442c798fd78d1308dfbd09.png)

During my research I stumbled upon [Fernandos article](https://www.serverless.com/blog/serverless-auth-with-aws-http-apis/) about Authorizers for HTTP APIs. Following his instructions I got the example working but I can’t map it to my use case, as I need a REST API.

Has anyone achieved this with serverless 1.70?

```auto
  Your Environment Information ---------------------------
     Operating System: win32
     Node Version: 12.16.1
     Framework Version: 1.70.1 (standalone)
     Plugin Version: 3.6.11
     SDK Version: 2.3.0
     Components Version: 2.30.10

```

---

<div class="post-metadata">

**Author:** ![OmniByte](https://avatars.discourse-cdn.com/v4/letter/o/e95f7d/32.png) [@OmniByte](https://forum.serverless.com/u/OmniByte)\
**Post date:** [May 27, 2020, 7:12am UTC](https://forum.serverless.com/t/configure-authenticator-for-rest-api/11524/2 "2020-05-27T07:12:55Z")

</div>

Update:

I used Dehli’s answer in the same SO post that I referenced in my initial question:

```
functions:
  functionName:
# ...
events:
  - http:
      # ...
      authorizer: 
         type: COGNITO_USER_POOLS
         authorizerId: 
           Ref: ApiGatewayAuthorizer

resources:
  Resources:
    ApiGatewayAuthorizer: 
      Type: AWS::ApiGateway::Authorizer
      Properties: 
        Name: CognitoUserPool
        Type: COGNITO_USER_POOLS
        IdentitySource: method.request.header.Authorization
        RestApiId: 
          Ref: ApiGatewayRestApi
        ProviderARNs: 
          - Fn::GetAtt:
              - UserPool
              - Arn

    UserPool:
      Type: AWS::Cognito::UserPool
```
