Cognito user pool authorizer With Serverless Framework

I need to authorize my API end point using aws cognito userpool. I can do it manually, but I need to automate the authorization part with the serverless framework.

Does the Serverless framework have support for aws cognito?

If so, how do we setup an aws-userpool with serverless?

Answers 1

  • Yes . Serverless (v1.5) support to Cognito user pool authorizer.

    If you use previous version of serverless you have to update v1.5 or later.

    For the user-pool authorization of api end point you have to specify pool arn.

    functions:
      hello:
        handler: handler.hello
        events:
          - http:
              path: hello
              method: get
              integration: lambda
              authorizer:
                name: authorizer
                arn: arn:aws:cognito-idp:us-east-1:123456789:userpool/us-east-1_XXXXXX
    

    More details read this article.


Related Articles