I
I
Ilya Kochkin2018-06-04 21:27:03
Sessions
Ilya Kochkin, 2018-06-04 21:27:03

A lot of questions about session, cookies and authorization?

I'll start with a stupid question. How does vk.com authorization work? why, no matter how long I enter the site, I do not enter my login and password. how it works? If this works through cookies, the next question arises is the lifetime of cookies in VK? how long do they have to live. made an experiment went to VK - logged in opened developer tools and decided to delete cookies. it seems like everything oYwgwKoo6sM.jpgis logically I should, roughly speaking, end the session and when I open the browser I should receive a login and password, but this does not happen, why? who's the fool here? me? but if I delete the cookie file from C:\Users\username\AppData\Local\Google\Chrome\User Data\Default I lose my session and enter my username and password.
The second question follows from the first question: how is an infinite session implemented? note (VK session). roughly speaking, I need to implement authorization in which the user logged in and he endlessly hung in the active session, even if he does not use the site and logged out only by the "logout" button.
I see it like this
1) enters login and password
2) login + encrypted + encrypted cookie_Id to them (I'm not strong in sessions)
3) this encrypted string is added to the database table and to this ill-fated cookie file
4) upon re-authorization, we check the encrypted a line in the database and in the cookie file if the user does not need to be authorized
??? if yes, then the question is how long the cookie file will live in paragraph 3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-06-04
@mr_Koch

you are not a fool, but just an inexperienced lazy person,
do your experiment in the "incognito" mode, and you will find out the answer
of another way to reliably save the state except through the cookie - no, so everything in them, everything in them
there are indestructible cookies (too lazy to look for VKontakte, but he can use something like that), so eternal sessions are made, of course, with checking for "suspicious activity" on the server

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question