Reputation: 33
I am looking for some general advice on how I should design/structure my auth flow for a react web app using aws amplify and cognito.
I had a small demo running that used the pre-built auth components however I realized that I wanted more control over it.
I found several guides online but they all did it a bit differently and as this is really my first time building a web app, I am not really sure which is 'correct'.
This is the guide I used and I have run into trouble with the routing aspect. Once I have a successful login, it will not redirect the user to the dashboard private route.
https://blog.logrocket.com/authentication-react-apps-aws-amplify-cognito/
The general structure of all the guides is pretty much the same. Separate containers for login/signup/password reset, etc. Most use private routes of some sort, but the way they choose to handle state or where they uses classes vs const variables/functions changes up.
I really want to learn the right way to do this and get the foundation of the app setup so its easy to work on / add features / scale in the future.
I assume I should figure out how to implement redux?
If anyone has any specific advice here, it would really be appreciated!
Upvotes: 1
Views: 565
Reputation: 355
I have created a simple React (no routes, no Redux) starting project for using AWS Cognito Auth with React and Amplify
https://github.com/domkoscielak/aws-cognito-auth-react
I hope it could be helpful.
Upvotes: 1