Cognito user pool authorizer With Serverless Framework

后端 未结 3 1179
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-31 00:42

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.

3条回答
  •  梦谈多话
    2020-12-31 01:27

    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.

提交回复
热议问题