diff --git a/frontend/src/app/core/turbo/turbo-requests.service.ts b/frontend/src/app/core/turbo/turbo-requests.service.ts index 41d98ea6da0..76305e6a10f 100644 --- a/frontend/src/app/core/turbo/turbo-requests.service.ts +++ b/frontend/src/app/core/turbo/turbo-requests.service.ts @@ -14,6 +14,15 @@ export class TurboRequestsService { html:string, headers:Headers }> { + const defaultHeaders = { + 'X-Authentication-Scheme': 'Session', + }; + + init.headers = { + ...defaultHeaders, + ...init.headers, + }; + return fetch(url, init) .then((response) => { return response.text().then((html) => ({ @@ -72,7 +81,9 @@ export class TurboRequestsService { public requestStream(url:string):Promise<{ html:string, headers:Headers }> { return this.request(url, { method: 'GET', - headers: { Accept: 'text/vnd.turbo-stream.html' }, + headers: { + Accept: 'text/vnd.turbo-stream.html', + }, credentials: 'same-origin', }); } diff --git a/frontend/src/stimulus/controllers/async-dialog.controller.ts b/frontend/src/stimulus/controllers/async-dialog.controller.ts index 2d0892701fe..9b4197abf7b 100644 --- a/frontend/src/stimulus/controllers/async-dialog.controller.ts +++ b/frontend/src/stimulus/controllers/async-dialog.controller.ts @@ -47,6 +47,7 @@ export default class AsyncDialogController extends ApplicationController { method: this.method, headers: { Accept: 'text/vnd.turbo-stream.html', + 'X-Authentication-Scheme': 'Session', }, }).then((r) => r.text()) .then((html) => { diff --git a/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts index 37dab0e9f47..345d6ca0424 100644 --- a/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts +++ b/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts @@ -57,7 +57,9 @@ export default class OpMeetingsFormController extends ApplicationController { .request( `${this.pathHelper.staticBase}/meetings/fetch_timezone?${urlSearchParams.toString()}`, { - headers: { Accept: 'text/vnd.turbo-stream.html' }, + headers: { + Accept: 'text/vnd.turbo-stream.html', + }, }, ); } diff --git a/frontend/src/stimulus/controllers/dynamic/recurring-meetings/form.controller.ts b/frontend/src/stimulus/controllers/dynamic/recurring-meetings/form.controller.ts index 64c6e0044bf..b9e9cd99427 100644 --- a/frontend/src/stimulus/controllers/dynamic/recurring-meetings/form.controller.ts +++ b/frontend/src/stimulus/controllers/dynamic/recurring-meetings/form.controller.ts @@ -25,7 +25,9 @@ export default class OpRecurringMeetingsFormController extends ApplicationContro .request( `${this.pathHelper.staticBase}/recurring_meetings/humanize_schedule?${urlSearchParams.toString()}`, { - headers: { Accept: 'text/vnd.turbo-stream.html' }, + headers: { + Accept: 'text/vnd.turbo-stream.html', + }, }, ); } diff --git a/frontend/src/stimulus/controllers/poll-for-changes.controller.ts b/frontend/src/stimulus/controllers/poll-for-changes.controller.ts index ec525ede39b..890f35c9bad 100644 --- a/frontend/src/stimulus/controllers/poll-for-changes.controller.ts +++ b/frontend/src/stimulus/controllers/poll-for-changes.controller.ts @@ -76,6 +76,7 @@ export default class PollForChangesController extends ApplicationController { void fetch(`${this.urlValue}?reference=${this.buildReference()}`, { headers: { Accept: 'text/vnd.turbo-stream.html', + 'X-Authentication-Scheme': 'Session', }, }).then(async (r) => { if (r.status === 200) { diff --git a/frontend/src/turbo/turbo-event-listeners.ts b/frontend/src/turbo/turbo-event-listeners.ts index 18fc192fd33..6fcaf91c669 100644 --- a/frontend/src/turbo/turbo-event-listeners.ts +++ b/frontend/src/turbo/turbo-event-listeners.ts @@ -31,6 +31,7 @@ export function addTurboEventListeners() { const headers = event.detail.fetchOptions.headers as Record; headers['Turbo-Referrer'] = window.location.href; headers['X-Turbo-Nonce'] = document.getElementsByName('csp-nonce')[0]?.getAttribute('content') || ''; + headers['X-Authentication-Scheme'] = 'Session'; }); // Turbo adds nonces to all scripts, even though we want to explicitly pass nonces