Sign in
Log inSign up
K Srinivas Rao

70 likes

·

4.7K reads

8 comments

Tyler
Tyler
Nov 14, 2022

I would appreciate if you could go into the backend as well 🙃. Great article!

2
·
·1 reply
K Srinivas Rao
K Srinivas Rao
Author
·Nov 15, 2022

Sure, coming soon...

·
Ahmad Yousif
Ahmad Yousif
Nov 14, 2022

I would do it slightly differently, I would send the rT in a cookie instead of sending it in the response , and in the frontend I resend this cookie on every request for protected route back to the backend and compare it's value with the original rT sent upon authentication which would be stored in the db, and maybe not storing the tokens in the local storage but rather in the memory.

2
·
·1 reply
K Srinivas Rao
K Srinivas Rao
Author
·Nov 15, 2022

Ah, yes.. Great suggestion... It's never a good idea to store the tokens on frontend. But I wanted to explain only the frontend side of the authentication in a visual manner, that's why I went with it. I'll explore the full stack side of it another day in a more secure way.

2
·
Gokul Gopi
Gokul Gopi
Nov 22, 2022

Everything was explained pretty nicely. Now I have much more clarity around this topic 👍. Waiting for the backend part..

1
·
Dennis Githinji Wakahia
Dennis Githinji Wakahia
Jan 4, 2023

nn

·
Damilola Ogunboyejo
Damilola Ogunboyejo
Apr 3, 2023

Hi K Srinivas Rao, can I get your email please, I need help with react query and nextjs

·
Gabhan O'Loughlin
Gabhan O'Loughlin
Apr 14, 2023

The axiosInstance.ts file no longer works with the latest React Query / Typescript (April 2023). Hopefully you can update the article. As someone who is new to React, your approach makes total sense to me, but I'm struggling to figure out how to make it work.

·