From 0dcc590a15df2b8bc6ae2e212859d10a8a396d6f Mon Sep 17 00:00:00 2001 From: Emerson Ford Date: Thu, 25 Jul 2019 18:55:50 -0700 Subject: [PATCH] Fixing bug with logout route --- server/routes/auth.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/routes/auth.ts b/server/routes/auth.ts index cc08b118..4ca0cc4a 100644 --- a/server/routes/auth.ts +++ b/server/routes/auth.ts @@ -61,13 +61,20 @@ authRoutes.all("/logout", (request, response) => { if (user) { let groundTruthURL = new URL(config.secrets.groundTruth.url); let requester = groundTruthURL.protocol === "http:" ? http : https; - requester.request(new URL("/api/user/logout", config.secrets.groundTruth.url), { + let req = requester.request({ + host: groundTruthURL.hostname, + path: "/api/user/logout", method: "POST", headers: { "Authorization": `Bearer ${user.token}` } - }).end(); + }); + req.on('error', (e) => { + console.error("Unable to logout: %s", e); + }); + + req.end(); request.logout(); } if (request.session) {