Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1d484d3

Browse files
committedApr 12, 2023
[Filing] Websocket - Pass auth via cookie
1 parent 31b33f3 commit 1d484d3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed
 

‎src/filing/actions/listenForProgress.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,17 @@ export default function listenForProgress() {
7171

7272
try {
7373
console.log(`-- Attempting connection to ${socketType}://${wsBaseUrl}${wsProgressUrl}`)
74+
document.cookie = 'X-Authorization-Token=' + AccessToken.get() + '; path=/';
7475
socket = new WebSocket(`${socketType}://${wsBaseUrl}${wsProgressUrl}`)
7576
} catch (e) {
7677
console.log(`--- Connection to ${socketType}://${wsBaseUrl}${wsProgressUrl} failed!`)
7778
error(e)
7879
console.log('---')
7980
}
8081

81-
socket.onopen = (event) => {
82+
socket.onopen = () => {
8283
console.log('-- Socket open! Sending Bearer token and then listening for Progress...')
8384
dispatch(requestProcessingProgress())
84-
socket.send(
85-
JSON.stringify({
86-
headers: {
87-
Authorization: 'Bearer ' + AccessToken.get(),
88-
},
89-
})
90-
)
9185

9286
// Keep connection alive by pinging server every 60s
9387
keepSocketAlive = setInterval(() => {

0 commit comments

Comments
 (0)
Please sign in to comment.