From 844e2ed5b0e2e6c74cd9d4c190434a00dfa2f276 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 3 Oct 2018 16:33:34 -0400 Subject: [PATCH] add back tokens --- embark-ui/src/services/api.js | 11 +++++------ lib/modules/webserver/server.js | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/embark-ui/src/services/api.js b/embark-ui/src/services/api.js index 1766b6903..cdcd3301e 100644 --- a/embark-ui/src/services/api.js +++ b/embark-ui/src/services/api.js @@ -136,23 +136,22 @@ export function authenticate(payload) { return post('/authenticate', {...payload, credentials: payload}); } -// TODO token for WS? export function listenToChannel(credentials, channel) { - return new WebSocket(`ws://${credentials.host}/communication/listenTo/${channel}`); + return new WebSocket(`ws://${credentials.host}/embark-api/communication/listenTo/${channel}`, [credentials.token]); } export function webSocketProcess(credentials, processName) { - return new WebSocket(`ws://${credentials.host}/process-logs/${processName}`); + return new WebSocket(`ws://${credentials.host}/embark-api/process-logs/${processName}`, [credentials.token]); } export function webSocketContractLogs(credentials) { - return new WebSocket(`ws://${credentials.host}/contracts/logs`); + return new WebSocket(`ws://${credentials.host}/embark-api/contracts/logs`, [credentials.token]); } export function webSocketBlockHeader(credentials) { - return new WebSocket(`ws://${credentials.host}/blockchain/blockHeader`); + return new WebSocket(`ws://${credentials.host}/embark-api/blockchain/blockHeader`, [credentials.token]); } export function websocketGasOracle(credentials) { - return new WebSocket(`ws://${credentials.host}/blockchain/gas/oracle`); + return new WebSocket(`ws://${credentials.host}/embark-api/blockchain/gas/oracle`, [credentials.token]); } diff --git a/lib/modules/webserver/server.js b/lib/modules/webserver/server.js index 077484606..936e96dff 100644 --- a/lib/modules/webserver/server.js +++ b/lib/modules/webserver/server.js @@ -163,10 +163,8 @@ class Server { } applyAPIFunction (cb, req, res) { - // FIXME Need to not authenticate WS request as they do not pass the toekn in the header yet const authToken = (!res.send) ? req.protocol : req.headers.authorization; if (!res.send) { - // console.dir(arguments); return cb(req, res); } this.events.request('authenticator:authorize', authToken, (err) => {