From f62a075c32a87e23a0a8a8803c42331a08023884 Mon Sep 17 00:00:00 2001 From: Meis Date: Mon, 14 Nov 2022 12:19:09 -0700 Subject: [PATCH] [Filing] Websocket - Pass auth via cookie --- src/filing/actions/listenForProgress.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/filing/actions/listenForProgress.js b/src/filing/actions/listenForProgress.js index 7549fd53f..7388765f1 100644 --- a/src/filing/actions/listenForProgress.js +++ b/src/filing/actions/listenForProgress.js @@ -71,6 +71,7 @@ export default function listenForProgress() { try { console.log(`-- Attempting connection to ${socketType}://${wsBaseUrl}${wsProgressUrl}`) + document.cookie = 'X-Authorization-Token=' + AccessToken.get() + '; path=/'; socket = new WebSocket(`${socketType}://${wsBaseUrl}${wsProgressUrl}`) } catch (e) { console.log(`--- Connection to ${socketType}://${wsBaseUrl}${wsProgressUrl} failed!`) @@ -78,16 +79,9 @@ export default function listenForProgress() { console.log('---') } - socket.onopen = (event) => { + socket.onopen = () => { console.log('-- Socket open! Sending Bearer token and then listening for Progress...') dispatch(requestProcessingProgress()) - socket.send( - JSON.stringify({ - headers: { - Authorization: 'Bearer ' + AccessToken.get(), - }, - }) - ) // Keep connection alive by pinging server every 60s keepSocketAlive = setInterval(() => {