In general, the situation is as follows:

It is necessary to authorize via VC, if you log in, cookies are not set, and if you repeat the operation, everything works with the same code. This is not the first time - the situation was somehow solved by itself, but now I don’t know what to do.

Maybe someone came across?

if (isset($_POST['token'])) { session_start(); $s = file_get_contents('Запрос данных'); $user = json_decode($s, true); $id = $user['identity']; $name = $user['first_name']; $lastname = $user['last_name']; $secondPastOfYear = 15778463; // Ставим куки SetCookie('id', $id, time() + $secondPastOfYear, "/"); SetCookie('name', $name, time() + $secondPastOfYear, "/"); SetCookie('lastname', $lastname, time() + $secondPastOfYear, "/"); } 
  • one
    And what will happen if you log in, and then - F5? There is an assumption that will work. If so, then check the send order (not determining the value) of the cookie and check. Who writes cookies at all: a page or a php script? - Bars
  • Works. The data in the POST come again, and the second time it works. It is worth checking - if there is a global POST array, then we write cookies from it. Anything more special. I will add the code to the question. - andrewshka
  • Well ... Again, the situation went away by itself. Everything works fine again, it is not clear why :) So who will have this kind of thing - just wait (actually not) :) - andrewshka