DEV Community

VinaySehwag14
VinaySehwag14

Posted on

How to add different Authentication in Mern App??

Hy Guys , I am making a e-commerce project using MERN stack and I need help from you guys . In this project , I use jwt authentication .So for login and signup user have to make user profile into my app , but i want to add feature of login through google , fb etc. So I want to know that where i can do this google auth or fb auth in backend or can i able to feature in this forntend .I dont how to do it .

Top comments (2)

Collapse
 
truemail785 profile image
Ozair

Hi Vinay. Authentication is done on backend only.
There is a library called passportJS. PassportJS is used to add user authentication in nodeJS backend. It also comes with strategies such as google strategy, or facebook strategy(github, twitter or any other strategy as well). You can easily find a tutorial on internet for passportJS.
Services like firebase or mongodb also provide user authentication features. So you dont have to code much. You can do your research and decide which one suits you better.
Here is a simple website I built which uses passportJS for user authentication using google/facebook/email login. ozcom.herokuapp.com/

Collapse
 
vinaysehwag14 profile image
VinaySehwag14

Thank you ozair for this information, you saved my a lot of time in research. Yup i saw your website. Its really good , i got inspiration for my project from their 😇, infact i order some products from their , can you tell me when i will be to get those products 😂😂.