Hello everyone. I studied and studied at MERN. I also created a project. Now I don’t believe what I did was right. Now that matters to me. Sorry my english:)
I have seen many projects on the internet, but the method used in most of them did not match mine. For example many people use jwt for authentication. But I use passportjs and passport-local-mongoose. I successfully registered and loginned in backen(express). In frontend every component I used action ( redux ) for get user information loginned or not like this:
UseEffect( ()=>{
User_Auth(12); // why 12? If I didnt write this value
// action cannot work but when I put work
// well and this value I cant do with.
} )
This methog is true? If you want to see this simple project please see this: https://github.com/Feruz00/login_register/tree/master
Thanks
Authentication is essential to any real application. When going about authentication you must keep in mind that nothing changes with how you should organize your application and you should implement authentication in the same way you would any other feature. It is relatively straightforward:
LOGIN_SUCCESS
, LOGIN_FAILURE
, etc.LOGIN_SUCCESS
, LOGIN_FAILURE
, etc).EXAMPLE: https://github.com/joshgeller/react-redux-jwt-auth-example