DEV Community

Cover image for Authentication in MERN stack.
Kunal Agrawal
Kunal Agrawal

Posted on • Updated on

 

Authentication in MERN stack.

Authentication in Mern Stack.

Authentication is a big problem for a website, app. As it divides content for different people, authorization of a content to edit, view, delete and update.
Points to consider for Authentication.

Never ever store passwords

Storing someone's password is not considered as a good practice, if by chance your data gets in wrong hands, it can lead to massive breach of a user data, personal information and identity.
Always hash passwords before storing.
To read more about hashing, follow this Link.

Giving user a nice user experience.

Now, that you can login and register users. how can you remember that user, if user refreshes his page. That's the problem, so to solve that issue you can use JavaScript libraries like JWT's, passport for authentication. They basically stores a user details in cookies, Local Storage or Session Storage in your web browser.

For more Better and Trustful user experience.

Use a third party API's like Google Auth, Facebook Auth. so that user can trust your website.

Things to remember.

  • Never Store Passwords.
  • Use Cookies / Sessions for nice user experience.
  • Third party Authentication for best experience.

for more you should definitely see this video from fireship.io

Top comments (0)

Top Posts from the React Ecosystem

1. Changes In The Official React Documentation

The former React Docs Beta has been officially released as the updated React documentation at react.dev after years of hard work and refinement. Check out the brand new React Docs: What’s New in the Updated React Docs

2. CRA's Time is Over

React developer team has removed create-react-app (CRA) from official documentation rendering it no longer the default setup method for new projects. The bulky setup, slow, and outdated nature of CRA led to its removal: create-react-app is officially dead

3. How to Fetch Dev.to Articles for Your Portfolio

Integrate the articles of your Dev.to profile into your personal portfolio with either React, Vue, or Next.js by following these simple steps. It outlines how to include frontend to pull the information and correctly utilizes the Dev.to API: How to Fetch Your Dev.to Articles for Your Portfolio with React