Home > Enterprise >  How do I add auth to and deploy my React app with lambda api?
How do I add auth to and deploy my React app with lambda api?

Time:03-18

I have locally working code for a React front-end application, hooked up to a serverless framework lambda back-end (which in turn accesses S3 and RDS). I'm now at the stage where I need to add user authentication to both the front and back-end, as well as deploy my solution.

I have cobbled together a Cloudfront distribution and s3 static hosting for the React portion, with the api available as a secondary origin on /api/*, however this solution seems awkward, and I'm not sure it helps me tackle auth.

Other guides that I've found suggest AWS-Amplify, or SST, but I have no experience with either.

Am I close to a well-structured roll-your-own solution, or completely on the wrong track? I'm happy to spend a little longer on a clean and future-proof solution, but am not adverse to side-stepping to a well respected tool.

CodePudding user response:

I opted to follow this guide on SST. Once I saw it did everything I could have wanted and more, I ported over my API and React code with minimal fuss. I wouldn't hesitate to recommend this guide (which leverages SST, Amplify and Cognito).

  • Related