Which one is most suitable for user login system with a 'keep me signed in' button? Sessions or cookies? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Which one is most suitable for user login system with a 'keep me signed in' button? Sessions or cookies?

15th Jun 2017, 3:50 AM
Chathura Madushanka Gamaethige
Chathura Madushanka Gamaethige - avatar
4 Answers
+ 1
Session is destroyed once you close website, so you'd have to set cookie that will hold eg.: "loggedIn" and everytime user enters the site, it'll check if it's set to "1" and log him in, otherwise show log in form.
15th Jun 2017, 8:21 AM
Jakub Stasiak
Jakub Stasiak - avatar
+ 1
Sadly it is, that is why I do not make such an button. Too much work for not so useful feature
15th Jun 2017, 2:13 PM
Jakub Stasiak
Jakub Stasiak - avatar
0
And then doesn't it unsafe to save sensitive data such as user id in a cookie? That is the problem I met
15th Jun 2017, 12:11 PM
Chathura Madushanka Gamaethige
Chathura Madushanka Gamaethige - avatar
0
agree with you
15th Jun 2017, 4:52 PM
Chathura Madushanka Gamaethige
Chathura Madushanka Gamaethige - avatar