Skip to content

Commit 7e6967c

Browse files
authored
browsertrix uploads: use application/x-www-form-urlencoded (#291)
fixes #283
1 parent 3615d33 commit 7e6967c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ui/upload.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,14 @@ export class BtrixClient {
475475
static async login({ url, username, password, orgName }) {
476476
const loginUrl = url + "/api/auth/jwt/login";
477477

478-
const form = new FormData();
478+
const form = new URLSearchParams();
479479
form.append("username", username);
480480
form.append("password", password);
481481

482-
const res = await fetch(loginUrl, { method: "POST", body: form });
482+
const headers = new Headers();
483+
headers.set("Content-Type", "application/x-www-form-urlencoded");
484+
485+
const res = await fetch(loginUrl, { method: "POST", body: form, headers });
483486
const auth = await res.json();
484487
const { token_type, access_token } = auth;
485488
if (!access_token || !token_type) {

0 commit comments

Comments
 (0)