From c2de7dbdb84fca75b6cd2fddd44b9dab64e70871 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Mon, 7 Nov 2022 18:49:36 +0100 Subject: [PATCH] webapp: Send X-Requested-With header for all requests This prevents browser password dialogs in all cases --- webapp/src/utils/authentication.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/webapp/src/utils/authentication.ts b/webapp/src/utils/authentication.ts index c6590b0..aef44c3 100644 --- a/webapp/src/utils/authentication.ts +++ b/webapp/src/utils/authentication.ts @@ -3,7 +3,10 @@ export function authHeader(): Headers { let user = JSON.parse(localStorage.getItem('user') || ""); if (user && user.authdata) { - return new Headers({ 'Authorization': 'Basic ' + user.authdata }) + const headers = new Headers(); + headers.append('Authorization', 'Basic ' + user.authdata); + headers.append('X-Requested-With', 'XMLHttpRequest') + return new Headers(headers); } else { return new Headers(); }