add back tokens
This commit is contained in:
parent
a288afbf68
commit
844e2ed5b0
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue