Похожие чаты

I have implemented passportjs session based authentication and I am

able to store session in mongodb but in react router I am able to navigate to private routes if I navigate through history.push() but if I change url directly and reload then I am directly logged out and redux loggedIn state is reset how can I avoid this scenario?

10 ответов

8 просмотров
Adi- Автор вопроса

In my case connect.sid which is a cookie is stored in browser when user logins but if I refresh page then redux state is reset and due to which user is navigated to login again

Adi- Автор вопроса

using redux persist will solve the problem or is it not required in this case?

This is actually an interesting problem of React

Adi- Автор вопроса
Thomas
This is actually an interesting problem of React

oh ok can you let me know how can it be done any suggestions?

Adi- Автор вопроса

@lprapp getting this issue thats why I asked

You could store the authentication data on the localStorage so it persists on a reload event. Just remember to don't abuse the localStorage use. Try to keep it simple since some user could disabled it

Adi- Автор вопроса
XOD
You could store the authentication data on the loc...

in my case I think I dont even require localstorage as I am using httpOnly cookie session based auth using passportjs

Adi
in my case I think I dont even require localstorag...

Well, I haven't use sessions, just jwt, so i don't have the knowledge to help you either, sorry

Adi- Автор вопроса
XOD
Well, I haven't use sessions, just jwt, so i don't...

you can read this later: https://gist.github.com/samsch/0d1f3d3b4745d778f78b230cf6061452

Похожие вопросы

Обсуждают сегодня

Здравствуйте! Есть вопросы по ПК: 1.1. Безопасно ли запускать программы, которым я не доверяю, в виртуальной машине под KVM+qemu? (x86_64) 1.2. То же самое при использовании ...
Pavel
5
Hi everyone! I have a two-folded message to share today. First: updates and news, as we are being asked for those. We still want to go like we did the last 6 years: we w...
Marten | Unibright.io
31
У меня вопрос, а какой уровень оптимизации ставить при сборке на i5 4 ядра 16G ddr3 ОЗУ и видюха Geforce GTX 970?
Sir Jiga
18
Guys, what’s the most expensive part of your budget for your business/startup/app/website?
Ice Kream
18
Скажите, можно ли как-то "переместить" динамический массив из одной переменной в другую? Скажем, переместить из TList<> в TArray<>. Именно переместить, а не скопировать. Если ...
Eugene Krasnikov (ᴊɪɴ x)
37
Happy Friday and happy CartesiWeekly! This week on the list: 🪲 Bug Buster Update 🎥 Erick de Moura’s interview with Ornella from Web3TV 👽 Thriving Cartesi alien 🇧🇷 SBRC hackat...
Nida | Cartesi - Never DM first or ask for funds!
1
Oh.... Admins at the main TG is already muted me. How many months Sir you muted me? Or forever if you are here @Janevietani @JohnnySonic
Charles Dar
28
комрады, че-та лыжы не едут var tmpFont: TFont; begin tmpFont:= TFont.Create; try case rgFontColor.ItemIndex of 0: tmpFont.Color:= clWindowText; 1: tmpFo...
Ed Doc
34
Вот еще криповенькая штука. uMain.pas(517,3) Warning: Case statement does not handle all possible cases И ЧО? 😂
Александр (Rouse_) Багель
20
Интересно, нет ли какого-то способа получить из dll не адрес самой метки, а адрес со смещением?
The Bird of Hermes
54
Карта сайта