private function _badToken401()
    {
        $this->addCorsHeaders();
        Utils::header("HTTP/1.1 401 Unauthorized");
        Utils::header('Content-type: application/json');
        echo json_encode(
            (object)['tokenService' => $this->_tokenServiceUrl . "login?" . http_build_query(
                ['redirectURL' => $this->_refUrl,
                 'service' => $this->_appID]
            )
            ]
        );
        // Use a testable method instead of calling exit() directly
        Utils::exitApp();
    }