#include #include #include #include #include bool authenticate(const std::string &token) { httplib::Client cli(config::config.getConfig()["auth_service"]); std::string body = R"({"token":")" + token + R"("})"; // body << R"({"token":")" << token << R"("})"; httplib::Result res = cli.Post("/api/access", body, JSON_TYPE); if (res->status == httplib::OK_200) { nlohmann::json resjson = nlohmann::json::parse(res->body); if (resjson["access"] == "reject") { return false; } return true; } return false; }