diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-03-01 16:17:33 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-01 16:17:33 -0600 |
| commit | d2d5dab7d4a4c8004eacf489e4d5d4120ed6dc8f (patch) | |
| tree | e1f8628fbf4e0f49d49fe4c7e5d60ed01a59c3ed /src | |
| parent | b16f069206a05ffdb696a886b2f9c887ee68f836 (diff) | |
| parent | 212e356fcb1cf431eb82a111e0dd6b8f9cbaaa52 (diff) | |
| download | slskd-d2d5dab7d4a4c8004eacf489e4d5d4120ed6dc8f.tar.gz | |
Merge pull request #374 from slskd/auth
Pass credentials to signalr hub negotiation when auth is disabled
Diffstat (limited to 'src')
| -rw-r--r-- | src/web/src/lib/api.js | 4 | ||||
| -rw-r--r-- | src/web/src/lib/hubFactory.js | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/web/src/lib/api.js b/src/web/src/lib/api.js index 9a62ed33..73e75373 100644 --- a/src/web/src/lib/api.js +++ b/src/web/src/lib/api.js @@ -1,5 +1,5 @@ import axios from 'axios'; -import { baseUrl, tokenPassthroughValue } from '../config'; +import { baseUrl } from '../config'; import * as session from './session'; axios.defaults.baseURL = baseUrl; @@ -13,7 +13,7 @@ api.interceptors.request.use(config => { config.headers['Content-Type'] = 'application/json'; - if (token && token !== tokenPassthroughValue) { + if (!session.isPassthroughEnabled() && token) { config.headers.Authorization = 'Bearer ' + token; } diff --git a/src/web/src/lib/hubFactory.js b/src/web/src/lib/hubFactory.js index 8ccd62ff..a64c5c40 100644 --- a/src/web/src/lib/hubFactory.js +++ b/src/web/src/lib/hubFactory.js @@ -10,7 +10,8 @@ import * as session from '../lib/session'; export const createHubConnection = ({ url }) => new HubConnectionBuilder() .withUrl(url, { - accessTokenFactory: session.getToken + withCredentials: true, + accessTokenFactory: session.isPassthroughEnabled() ? undefined : session.getToken }) .withAutomaticReconnect([0, 500, 1000, 3000, 5000, 5000, 5000, 5000, 5000]) .withHubProtocol(new JsonHubProtocol()) |
