From 9db23f3670a4bf43ccf477fb1618f53de15faa6d Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 9 Jan 2025 17:44:38 -0800 Subject: [PATCH] browsertrix uploads: use application/x-www-form-urlencoded, possibly fixes #283 --- src/ui/upload.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/upload.ts b/src/ui/upload.ts index 2ecadad0..023d15c5 100644 --- a/src/ui/upload.ts +++ b/src/ui/upload.ts @@ -475,11 +475,14 @@ export class BtrixClient { static async login({ url, username, password, orgName }) { const loginUrl = url + "/api/auth/jwt/login"; - const form = new FormData(); + const form = new URLSearchParams(); form.append("username", username); form.append("password", password); - const res = await fetch(loginUrl, { method: "POST", body: form }); + const headers = new Headers(); + headers.set("Content-Type", "application/x-www-form-urlencoded"); + + const res = await fetch(loginUrl, { method: "POST", body: form, headers }); const auth = await res.json(); const { token_type, access_token } = auth; if (!access_token || !token_type) {