public function createAutoLoginTokenAndCookie(int $id)
    {
        $authtok = new AuthToken($this->db);
        $authtok->setId($id);
        $authtok->setExpires($this->expires_after);

        setcookie($this->cookie_name, $authtok->generate(), $authtok->getExpiresTimestamp(), '/');
    }