DEV Community

Cover image for MERN Stack Authentication Tutorial (Part 1 - The Backend)

MERN Stack Authentication Tutorial (Part 1 - The Backend)

SalarC123 on June 24, 2021

This tutorial will be split into two parts because its a lengthy, although relatively straightforward, process, so stay tuned for the second part t...
Collapse
 
abrower10612 profile image
Andrew Brower

This blog post is excellent and really breaks the process down nicely. Thank you for taking the time to do this!

Collapse
 
nyambura00 profile image
Winnie Nyambura

Well explained, much thanks!

Collapse
 
mirandaftiago profile image
Tiago Miranda

Hi Salarc, this outcome is expected?

Image description

I went to pick the token here, after emulating the login behavior

Image description

Collapse
 
kangelkov profile image
kangelkov

You've lost me from the article when I saw that you're saving the JWT's in the localStorage.

Best way would be to use a http-only cookie to save the JWT on user's end. Please, refrain from those bad practices! :)

Collapse
 
craftogrammer profile image
Rahul

agree!

Collapse
 
elamiir profile image
El-amiir

Love It Thanks.

Collapse
 
simpleitis profile image
Amar Krishna

Amazing tutorial

Collapse
 
rickystylz01 profile image
Ricardo Maya

Thanks for the post I thought it was very well articulated and helpful!

Collapse
 
romil_code profile image
Romil Jain

Thanks man, Really easy to understand

Collapse
 
karamsahoo profile image
KaramSahoo

Really helpful!

Collapse
 
genosoo profile image
Geno Ureta

where is the .env file?

Collapse
 
salarc123 profile image
SalarC123

You create your own .env file. You don't want to share this online because it has your secret environment variables

Collapse
 
zukhrofy profile image
zukhrofy abbar

in "Verify JSON Web Token" part, did you mean env.JWT_SECRET?