How to Create an Authenticated REST API on AWS with API Gateway, Lambda, Cognito, & AWS Amplify

  Рет қаралды 25,668

Nader Dabit

Nader Dabit

Күн бұрын

Пікірлер: 73
@adR9990
@adR9990 3 жыл бұрын
Love that you were able to condense so much information in a short video, gw!
@pemessh
@pemessh 2 жыл бұрын
Wow. how come the freaking youtube algorithm did not suggest this video to me? I finally got this working for a personal project. Super happy.
@RaulNussbaum
@RaulNussbaum Жыл бұрын
This was super helpful in 2023; thank you so much!
@chetanpatel1464
@chetanpatel1464 3 жыл бұрын
Thank you so much for doing videos like this. I've been learning amplify for the last 4 months using your videos to help me for projects at work. I'm just about to put my first app into production in the next couple of weeks
@ApoorvMote
@ApoorvMote 3 жыл бұрын
I was actually hoping to see same exact tutorial but backend (rest api, lambda, cognito) built with CDK instead of amplify cli
@naderdabit
@naderdabit 3 жыл бұрын
Hey, great feedback, will set something like this up next
3 жыл бұрын
@@naderdabit that would be great, thanks
@andriys5772
@andriys5772 3 жыл бұрын
Good video related to setup cognito user pool and client via aws CDK kzbin.info/www/bejne/p6Ksf5V3ZsShhLc
@khandoor7228
@khandoor7228 3 жыл бұрын
Fantastic Nader, I have been exploring exactly this and you helped me out immensely! Thanks! I've been working a lot with Amplify and Amplify Admin (since its been out) and fine grained access has been interesting. I am tracking you and the team for all the content you can put out, so thanks a lot man!
@naderdabit
@naderdabit 3 жыл бұрын
Glad to hear it, we're working to do a lot more next year!
@saurabrakshit405
@saurabrakshit405 2 жыл бұрын
Amazing Video ! Please make a separate vdo on below topic coz there is no resource in internet related to this topic. I want to know how to do the Sign Up, Login & other MFA in React-Native App, if I already have a existing backend in AWS Cognito . And have the below details of the existing backend :- aws_cognito_identity_pool_id: aws_cognito_region: aws_user_pools_id: aws_user_pools_web_client_id:
@scottmanny
@scottmanny 3 жыл бұрын
Thanks Nader, spent all day on this before finding your video.
@saurabrakshit405
@saurabrakshit405 2 жыл бұрын
Amazing Video ! But, I want to know how to do the Sign Up, Login & other MFA if I already have a existing backend in AWS Cognito . And have the below details of the existing backend :- aws_cognito_identity_pool_id: aws_cognito_region: aws_user_pools_id: aws_user_pools_web_client_id: I hope this question will generate curiosity in you. Please make a separate vdo on this topic
@acedpyre7190
@acedpyre7190 3 жыл бұрын
Thanks for this video, definitely got me a Bit further. I’m hoping to see how we can take that user object in the lambda function and, for example, enrich the user with “user preferences” by creating a record in a db for said user, and then allow the user to edit their preferences. I noticed a lot of these examples typically revolve around blogs, and don’t go into depth beyond default Cognito options.
@miguel220369
@miguel220369 2 жыл бұрын
Thank you, I spent 2 days looking for just this. Great video, straight to the point
@guna23785
@guna23785 3 жыл бұрын
This is an awesome work.. very very crisp and to the point ... Much appreciated 🙏
@naderdabit
@naderdabit 3 жыл бұрын
Awesome to hear!
@m4monzter
@m4monzter 2 жыл бұрын
Step by step and detailed video in reasonable span!! Thank you so much 🙌🏼
@responseready7375
@responseready7375 2 жыл бұрын
How can I pull the cloudformation template from the cloud? Whenever I re-deploy my amplify project, the Authorizer is gone because it was not added to the template in the first place.
@wreckuiem
@wreckuiem 2 жыл бұрын
Incredible, spent a lot of time trying to find this material, thank you
@CodingCatDev
@CodingCatDev 3 жыл бұрын
Love the green, but I am a big fan of the purple 💜. Oh yeah and great video too!
@naderdabit
@naderdabit 3 жыл бұрын
Haha, thank you :)
@AhmadAwais
@AhmadAwais 3 жыл бұрын
Me to. Purple can be genius. Good one Nader.
@dannylim1525
@dannylim1525 3 жыл бұрын
great video, i really like the color theme . is that color theme custom made or imported ?
@utilisemedia
@utilisemedia 3 жыл бұрын
Thank you Nader, this was very helpful. I’d love to see an example using Swift/iOS (I’m new to both)
@naderdabit
@naderdabit 3 жыл бұрын
Hey thanks, glad you enjoyed it, may try to do something with React Native there on mobile
@devwax
@devwax 3 жыл бұрын
Superb explanation! A million thanks. Subscribed. Going to check out your other videos now.
@francescociulla
@francescociulla 3 жыл бұрын
Thanks Nader!
@nicwanavit5463
@nicwanavit5463 3 жыл бұрын
Its awesome, the same tutorial using SAM would be nice too :)
@jibreelkeddo7030
@jibreelkeddo7030 Жыл бұрын
Great and concise explanation -- Subscribed :)
@mohanraj6361
@mohanraj6361 2 жыл бұрын
Thanks for the detailed explanation .Much appreciated
@markusfeljofsen8345
@markusfeljofsen8345 Жыл бұрын
Hey, as many others mentioned before : how to use cloudformation template to do this? Because otherwise everytime you make changes to the API now, it switches back to IAM or NONE as Authorization and deletes the Authorizers.
@samuelkamuli2867
@samuelkamuli2867 3 жыл бұрын
I was just looking for a such a resource. Thanks!
@madak17
@madak17 3 жыл бұрын
Awesome guide! It really helped me get started with AWS Lambdas. A question though, if you wanted to make a call to your API from an unauthenticated user (and have it go through) how would you do that? As you showed, just removing the user token breaks the call, and trying to hit it without logging in results in "Uncaught (in promise) The user is not authenticated".
@rakeshrao21
@rakeshrao21 Жыл бұрын
Thanks so much. Your video helped me a lot!!
@Madeinchinaagain
@Madeinchinaagain 2 жыл бұрын
Nowadays, Amplify encourages you to use Amplify to spin up your dev and production environment using the CLI. This means that most of your configuration should be done through the CLI so Amplify can keep track of different changes (to Cloudformation resources, I guess). Will Amplify "know" about the changes you do (e.g. setting up your API Gateway to use Authorizers) through the AWS Console UI?
@Madeinchinaagain
@Madeinchinaagain 2 жыл бұрын
I tried an ‘amplify pull’ and no luck
@Weagle1337
@Weagle1337 2 жыл бұрын
I got the same problem, my authorizer is deleted when I update my API
@yudhiesh1997
@yudhiesh1997 3 жыл бұрын
Could you do a tutorial on multi-tenancy with AWS Cognito and AWS Amplify?
@daviddoyle7580
@daviddoyle7580 5 ай бұрын
Great video, just wondering is it safe to have the token in the client side variable as shown here to be passed in the header? It seems like Amplify doesnt offer any server side token so that we could store it in a http only cookie and pass it with every api request thereafter.
@niksadi
@niksadi Жыл бұрын
thank you Nader! Can you let me know if we have identity pool how can we get access to temporary credentials for gues. how do we get the guest token ?
@niceOneSonnyAgain
@niceOneSonnyAgain 3 жыл бұрын
another AWSome video from Nader!
@chokeslam1996
@chokeslam1996 3 жыл бұрын
Hi there, Fantastic video! When I use this tutorial I can get the access token without issue but when I try to get the data back is console.logs an error saying that the API does not exist. Have you any ideas? thank you in advance!
@balls69er
@balls69er 3 жыл бұрын
Hi I'm getting the same error "API Name" does not exist when I try and connect to my API. Any help would be appreciated
@clarotechuk
@clarotechuk 3 жыл бұрын
I have been looking for a video like this for so long - just what I needed. Thank You. Would it work in the same way for a Social login in (say Google or Facebook) using the Cognito Auth component?
@trevorhallett271
@trevorhallett271 3 жыл бұрын
Exactly what I was looking for thank you!
@brendancurtin6378
@brendancurtin6378 3 жыл бұрын
Excellent video. Did you know that using the header "authorisation" instead of "Authorisation" both in the browser code and the Authorizer, that it does not work. If you use "authorisation" as the header name API.get() adds additional fields to the token (visible in Chrome tools) and the Authoriser fails. I assume that API.get() middleware is responsible for this - but did not check the code. Took me an hour of head-scratching before going back to the video and noticing. Maybe a non reserved header name look-alike would have been a better choice!
@markusspenninger6630
@markusspenninger6630 Жыл бұрын
I guess amplify as a default export is deprecated and you would need to import it as a named export: import { Amplify } from 'aws-amplify'
@cliffjohnson8165
@cliffjohnson8165 3 жыл бұрын
This is sweet! However, is there a way when you are in API Gateway setting the path and ANY to the Authorization provider to default this? I don't want to have to go in and do this every time I create a new API path. I tried, thinking, maybe if I set this up in API gateway first and configure the authorizer, if I then with the CLI run - amplify api update and add a new path that it would pickup the authorizer but it seems to actually override the existing configuration where I then have to go in and setup the authorizer all over again for each path. That is definitely not scalable. I need a solution where I configure the authorizer once, really at the amplify project level and everything else I do from that point, inherits the authorizer. Is that possible?
@cliffjohnson8165
@cliffjohnson8165 3 жыл бұрын
I guess even to extend that further. I want to support multiple cognito user pools. Even if it was possible to default a single user pool, I'd really rather be able to default a group of user pools, with something like an array of user pools. Effectively, the ask would be to have an array of user pools provide auth to the API by simplfy configuring this one time on the API Gateway where those user pools would propogate to all the endpoints in that gateway. Obviously if I can do this via infrastructure as code (IaC) (, where I just deploy a new cognito user pool that is authorized, that is ideal. However, even if that is manual, I'd appreciate the option.
@sananbintahir5891
@sananbintahir5891 3 жыл бұрын
@@cliffjohnson8165 I was struggling with this for 3 days, and finally found a solution. To configure this automatically, you have to edit the cloudformation file of the API. In the formation file, you have the AWS::ApiGateway::RestApi Resource. In the body parameter, there is the OpenApi definition of the API and the paths. Here, in the "securityDefinitions", you can do "securityDefinitions": { "": { "type": "apiKey", "name": "Authorization", "in": "header", "x-amazon-apigateway-authtype": "cognito_user_pools", "x-amazon-apigateway-authorizer": { "type": "cognito_user_pools", "providerARNs": [ ] } and then "security": [ { "": [] } ] Take a look at docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-enable-cognito-user-pool.html
@Weagle1337
@Weagle1337 2 жыл бұрын
Why when I update my API it deletes the Cognito Authorizer created from AWS Console?
@jorgetovar621
@jorgetovar621 Жыл бұрын
How do you deploy updates to the lambda function?
@panagiotisgiannelos3767
@panagiotisgiannelos3767 Жыл бұрын
Thanks GSP
@aoatom8244
@aoatom8244 2 жыл бұрын
default Authorization when restricting API with "add auth" by Cognito is "Auth: AWS IAM" ?
@SzymonCFG
@SzymonCFG 2 жыл бұрын
How can i use amplify to configure the api gateway authorizer? So i can make i repeatedly?
@dpklabs
@dpklabs 3 жыл бұрын
Is there a clean way to prefill a users email into the pre-built auth component? I have a use case where I get a user's email through an on-boarding flow before they register.
@danielgannage8109
@danielgannage8109 3 жыл бұрын
Does this work for react native front end? If so, is there any documentation on this?
@maxwellgover8820
@maxwellgover8820 3 жыл бұрын
Would this work the same way if I chose to use the ExpressJS function?
@Ethlon
@Ethlon 3 жыл бұрын
Can you show how to create Authenticated REST API with private endpoint to VPC in AWS Amplify?
@StorkCo
@StorkCo 3 жыл бұрын
Thanks!
@neets7519
@neets7519 2 жыл бұрын
Thanks! 🤜🤛
@SM-vo5gj
@SM-vo5gj 3 жыл бұрын
Can we get a link to your extensions?
@prateekrobot
@prateekrobot 5 ай бұрын
Thanks
@iliya24
@iliya24 3 жыл бұрын
Great video thx
@ahbahb3195
@ahbahb3195 Жыл бұрын
When we send this request, we can see jwt token in header, is it safe ?
@nicolasp7997
@nicolasp7997 2 жыл бұрын
how can i do the same with custom ui?
@themusic1609
@themusic1609 3 жыл бұрын
Please let me know how can I use RDS (MSSQL) datasource with aws appsync/amplify and how to connect with react js application
@naderdabit
@naderdabit 3 жыл бұрын
Hey, did you see this video? kzbin.info/www/bejne/ponHanV5rNWdnqM I used RDS with AppSync and a client application, but instead of MSSQL used Postgres, but the idea is similar.
@toddtrowbridge5669
@toddtrowbridge5669 2 жыл бұрын
Maybe consider saying log instead of “log out” when printing because you’re constantly saying “log out user” when printing user to the console
@henrilambert3474
@henrilambert3474 Жыл бұрын
Thanks a lot, you unblocked me big time :)
AWS Amplify: Adding a RESTful backend to reactjs
21:34
Focus Otter
Рет қаралды 35 М.
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 2,4 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,2 МЛН
Мама у нас строгая
00:20
VAVAN
Рет қаралды 10 МЛН
How To Choose Mac N Cheese Date Night.. 🧀
00:58
Jojo Sim
Рет қаралды 87 МЛН
Build a HTTP API using AWS Lambda and API Gateway
24:21
Jonathan Davies
Рет қаралды 17 М.
Serverless Functions in Depth with AWS Amplify
1:08:33
Nader Dabit
Рет қаралды 46 М.
Secure API Gateway using Cognito Authorizer (NEW)
29:51
LoveToCode
Рет қаралды 43 М.
ЭЛЕКТРОШОКЕР НЕ ПОМОГ! 😮
0:32
КиноСклад
Рет қаралды 3,1 МЛН