Build an Authentication/Login System on AWS with React.js and a Serverless API - Part 2 (frontend)

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • This is a 2 part tutorial series where I talk about how to build a complete register / login system on AWS from scratch. The backend is a node.js serverless API with a dynamodb for user information storage. It uses bcrypt to encrypt passwords and uses jwt to generate tokens. The frontend is built with react.js and is hosted on an AWS S3 bucket.
    Support the channel plz 😊: www.buymeacoff...
    Part 1 (backend): • Build an Authenticatio...
    video on how to host a website with a custom domain and https: • Host a Website on AWS ...
    bucket policy: jinmeister.com...

Комментарии • 55

  • @noeldolan518
    @noeldolan518 Год назад

    Another great video following on from part 1. Not too surprising that as video is a couple of years old, I ran into a few minor problems related updated version of react-router-dom, but managed to eventually get around them.
    Big thank you for taking the time to put this video together. 👍😎

    • @R.Yuvashri
      @R.Yuvashri 2 месяца назад

      I have got the error in register. js as status is undefined instead of displaying already exists could u pls help me ?

  • @lizzigibson2927
    @lizzigibson2927 Год назад

    great videos! They've been really useful to put a fullstack app together on AWS. I'm excited to see more!

    • @FelixYu
      @FelixYu  Год назад +1

      Glad that u found it helpful!!

  • @mottacoke
    @mottacoke Год назад

    Well done mate! Honestly one of the best tutorials Ive seen in ages.

  • @js__k984
    @js__k984 5 месяцев назад +1

    I love your videos! However, React is evolving so quickly that this example requires many changes in various parts 😂

  • @joecrash
    @joecrash Год назад

    I really enjoy your short, simplistic tutorials - thank you! I have tried to walk through this step by step but due to the new v6 of react-router-dom, I'm unsure exactly how to make it work without getting a blank page at time for the protected pages. Could you please post a follow-up for this project as I really appreciate the simplicity of the project without a lot of necessary things you see with other tutorials.

  • @rockvnme375
    @rockvnme375 2 года назад +1

    Love it so much, I would like to watch a login with Cognito User Pool. Thanks 😘

    • @FelixYu
      @FelixYu  2 года назад

      Glad it helped

    • @joecrash
      @joecrash Год назад

      Yes, please. +1 for Cognito.

  • @DaveThomson
    @DaveThomson 3 года назад

    It works! Was able to create an account and login

    • @sivaprasad0215
      @sivaprasad0215 2 месяца назад

      Actually I got runtime error as an cannot read properties of undefined(reading status),could you please help me by giving any solution

  • @garymarshall7410
    @garymarshall7410 2 года назад +1

    Thanks!

  • @goodvibes1581
    @goodvibes1581 5 месяцев назад

    Thank You SO much ♥

    • @sivaprasad0215
      @sivaprasad0215 2 месяца назад

      Do u got the output

    • @sivaprasad0215
      @sivaprasad0215 2 месяца назад

      I am getting an error as cannot read properties of undefined

  • @riyazdharamshi4859
    @riyazdharamshi4859 2 года назад +1

    Great videos! Why not use AWS Cognito instead of building everything from scratch? Any thoughts on AWS Amplify?

    • @FelixYu
      @FelixYu  2 года назад +2

      That’s a good call out..aws amplify is prob a simpler solution. This is a tutorial for ppl to understand the ins and outs of the system

  • @dreepk
    @dreepk 3 года назад

    gonna love this i know for sure

  • @khandoor7228
    @khandoor7228 3 года назад

    There is interest here for more. Let's add on to this please maybe another database for 'Projects' or something and really explore fine grained authorization. So maybe an Admin can add projects and non-logged in and Guest users can only view the Projects. Just an idea that builds on top of this. Also what about storing our User to Global state using Context api?

  • @a2lcampignite266
    @a2lcampignite266 2 года назад

    Hi Felix, would it possible to have a tutorial on the refresh token?

  • @SergeyGrebenkin
    @SergeyGrebenkin 2 года назад +1

    Couple of comments to this tutorial. If you open frontend and test from chrome (not from postman), it uses CORS preflight request to OPTIONS method of register resource in backend.
    1. What you need to do is to specify the lambda handler for OPTIONS method of register resource in API and write the following in lambda index.js:
    case event.httpMethod === 'OPTIONS':
    response = util.buildCORSResponse(200, 'Success');
    break;
    where buildCORSResponse is in util.js:
    function buildCORSResponse(statusCode, body) {
    return {
    statusCode: statusCode,
    headers: {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "content-type,X-Amz-Date,X-Amz-Security-Token,Authorization,X-Api-Key,X-Requested-With,Accept,Access-Control-Allow-Methods,Access-Control-Allow-Origin,Access-Control-Allow-Headers",
    "Access-Control-Allow-Methods": "OPTIONS,POST,GET,PUT,DELETE",
    "Content-Type": "application/json"
    },
    body: JSON.stringify(body)
    }
    }
    2. Bind OPTIONS method for each resource to lambda in API Gateway, so lambda could handle OPTION requests from clients and return the above-mentioned values. This is important!
    after that the register tab will work as shown in the video.

    • @lundkvistarn
      @lundkvistarn 2 года назад

      I still get the CORS error when trying the register form. I have added the case in inde.js and i added the function in util.js.

    • @SergeyGrebenkin
      @SergeyGrebenkin 2 года назад

      @@lundkvistarn Use Firefox browser to see the request and response. F12->Network. It shows more information than Chrome.

    • @lundkvistarn
      @lundkvistarn 2 года назад +1

      @@SergeyGrebenkin Managed to solve it thanks. I had to also enable CORS on the post method in the API gateway.

    • @saraths5889
      @saraths5889 2 года назад +1

      Still get from origin 'localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. PLs advise

    • @saraths5889
      @saraths5889 2 года назад

      @@lundkvistarn can you help me: i still get the CORS error, even after adding the code and enabling the CORS in Gateway!

  • @rodrigofrancalacci1
    @rodrigofrancalacci1 Год назад

    Building an Ecommerce, I would like to know how do a create a profile page for each user once login happens, with its photo, wish list products, orders history, etc... But can't find a way to save and retrieve this information using the AWS bundle.

  • @bao20s
    @bao20s Год назад

    I got the cors No 'Access-Control-Allow-Origin' header is present on the requested resource. tried different ways to enable cors in api gateway but still doesn't work

  • @noahsmith518
    @noahsmith518 Год назад

    im getting this error when trying to make the axios requests from the frontend (they work in postman just fine):
    {my api gateway}.... blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

  • @dimitardimitrov2664
    @dimitardimitrov2664 2 года назад

    Felix, what about hiding my x-api-key from the client? There is no server in the static S3 website, so I can't really send it from there. What do you purpose? (CloudFront & lambda@edge maybe?)

  • @studentx35in32
    @studentx35in32 Год назад

    I retied in 3 regions (that was irritating but I did) I was not able to test dummy api (forget the remainig part)

  • @AliHumadi
    @AliHumadi Год назад

    why i ge
    t 401 and sometimes 502 error

  • @sushmasrivemparala1461
    @sushmasrivemparala1461 2 года назад

    Can you keep those front end and backend files?

  • @chamberscdaniel
    @chamberscdaniel 2 года назад

    Can you make a tutorial about restricting video content on the premium section?

    • @rajanyt7343
      @rajanyt7343 Год назад

      i know where your heading to ?

  • @32_thanushj20
    @32_thanushj20 2 месяца назад

    Can anyone share the code ?

  • @petarbjelica4508
    @petarbjelica4508 2 года назад

    Hi Felix, i have a question regarding S3 bucket settings. I was curious, if i allow public access to my bucket, does that mean that anyone can write in it ? ( I am afraid that can make my data to go over the amazon free limit, and charge me on my credit card )

    • @FelixYu
      @FelixYu  2 года назад

      the way we set up the s3 access policy (i.e., allow public access for website hosting) is only for public read NOT write. other people cannot write files to it!!!!

    • @Dontcaredidntask-q9m
      @Dontcaredidntask-q9m 2 года назад

      @@FelixYu buckets should never be public, fullstop

  • @meteisiksalan93
    @meteisiksalan93 3 года назад

    Would you be able to share the github for the front-end code portion aswell?

    • @FelixYu
      @FelixYu  3 года назад

      here is the source code for the frontend:
      github.com/felixyu9/complete-register-login-system-frontend

  • @ankitdahake5207
    @ankitdahake5207 2 года назад

    Hey Felix I am getting error the back end server is down what to do now

    • @FelixYu
      @FelixYu  2 года назад

      that means there is an error in the lambda function. go to the lambda console -> monitoring -> view logs in cloudwatch. u can see the error there and fix it accordingly

  • @kkunal45
    @kkunal45 2 года назад

    Good job but i am getting 405 Method not allowed error

    • @FelixYu
      @FelixYu  2 года назад +1

      Make sure u have the endpoint and method set correctly

    • @kkunal45
      @kkunal45 2 года назад

      @@FelixYu yes it got resolved thanks