From 23f227dd0d3885c0229a9eff670f1ba21d24d42b Mon Sep 17 00:00:00 2001 From: Yoshie Muranaka Date: Fri, 1 May 2020 14:19:43 -0700 Subject: Add XSRF token to websocket connection Resolves HTTP authentication failure when attempting to make a websocket connection. Signed-off-by: Yoshie Muranaka Change-Id: Ie833f1cd281dd3b7124ac798eb5318b24df0ed8f --- src/store/plugins/WebSocketPlugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/store/plugins/WebSocketPlugin.js') diff --git a/src/store/plugins/WebSocketPlugin.js b/src/store/plugins/WebSocketPlugin.js index 409b16860..965c32c92 100644 --- a/src/store/plugins/WebSocketPlugin.js +++ b/src/store/plugins/WebSocketPlugin.js @@ -18,7 +18,8 @@ const WebSocketPlugin = store => { }; const initWebSocket = () => { - ws = new WebSocket(`wss://${window.location.host}/subscribe`); + const token = store.getters['authentication/token']; + ws = new WebSocket(`wss://${window.location.host}/subscribe`, [token]); ws.onopen = () => { ws.send(JSON.stringify(data)); }; -- cgit v1.2.3