Easily Authorize API Calls With AWS Cognito and API Gateway

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 9

  • @cloudmancer
    @cloudmancer  3 місяці тому

    Which topics would you like to see me make videos on next?

  • @LaraDistribution
    @LaraDistribution 23 дні тому +1

    This is great. Do you know with API gateway + cognito authorizer, how to send unauthorized requests to cloudwatch logs or s3?
    Also would love to see a video on a detailed WAF and adding to API gateway, cloudfront, etc with cdk.

    • @cloudmancer
      @cloudmancer  19 днів тому

      Hey!
      Yes, API Gateway supports logging unauthorized requests to CloudWatch if you enable logging in the API Gateway settings. To do this in the CDK, you can use the API Gateway Stage construct and specify a accessLogDestination with a CloudWatch log group. If you also wanted to set these logs up to go to S3, you could create a lambda to do that.
      I will look into doing a video about WAF and API Gateway/CloudFront for a video, thanks for the great suggestion!
      API GW Stage Construct: docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.Stage.html

  • @DavidMChen-tp1li
    @DavidMChen-tp1li 2 місяці тому +1

    Hi Ryan, thanks for great content - great value and love the format!
    In CDK is it possible to setup RBAC with a Cognito authorizer - protecting ApiGateway routes?
    If yes, then I’d like to make this a video request.
    Thanks again!

    • @cloudmancer
      @cloudmancer  2 місяці тому +1

      Hey,
      Off the top of my head, I am not sure if this is possible, but I will look into it!

  • @blanky_nap
    @blanky_nap 21 день тому +1

    how to use this info in production? in prod you don't c&p the tokens to the shell

    • @cloudmancer
      @cloudmancer  19 днів тому

      Hey,
      Yes correct, you would probably not do this through the CLI. You would instead add the token to the header of your API request in the code like "'Authorization": "Bearer ${idToken}", or something along those lines. This is how I usually do it with Axios by adding an interceptor to append that header to each API call before its made.
      Hope this helps!

    • @blanky_nap
      @blanky_nap 18 днів тому +1

      Copy that, that thanks! Since you ask about topics for videos I think one important topic it vpc endpoint service (not vpc endpoints). Would be interesting how to set it up and more importantly how to configure my app to consume that service. Thanks in advance!

    • @cloudmancer
      @cloudmancer  4 дні тому

      This is a great suggestion, I will look into it, thank you!