Skip to content

Commit

Permalink
Merge pull request #276 from hacktheu-org/master
Browse files Browse the repository at this point in the history
Fixing bug with logout route
  • Loading branch information
petschekr authored Jul 27, 2019
2 parents 8e123f5 + 8a94c75 commit 39a8437
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions server/routes/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 39a8437

Please sign in to comment.