src/Web/User.php
protected function sendIdentityCookie($identity, $duration)
    {
        $cookie = Reaction::create(array_merge($this->identityCookie, [
            'class' => 'Reaction\Web\Cookie',
            'value' => json_encode([
                $identity->getId(),
                $identity->getAuthKey(),
                $duration,
            ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
            'expire' => time() + $duration,
        ]));
        $this->app->response->getCookies()->add($cookie);
    }
protected function sendIdentityCookie($identity, $duration)
    {
        $cookie = Reaction::create(array_merge($this->identityCookie, [
            'class' => 'Reaction\Web\Cookie',
            'value' => json_encode([
                $identity->getId(),
                $identity->getAuthKey(),
                $duration,
            ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),
            'expire' => time() + $duration,
        ]));
        $this->app->response->getCookies()->add($cookie);
    }
Sends an identity cookie.
This method is used when [[enableAutoLogin]] is true.
It saves [[id]], [[IdentityInterface::getAuthKey()|auth key]], and the duration of cookie-based login
information in the cookie.
@param IdentityInterface $identity
@param int               $duration number of seconds that the user can remain in logged-in status.
@see loginByCookie()