Skip to content

Commit

Permalink
browsertrix uploads: use application/x-www-form-urlencoded, possibly f…
Browse files Browse the repository at this point in the history
…ixes #283
  • Loading branch information
ikreymer committed Jan 10, 2025
1 parent 3615d33 commit 9db23f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ui/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9db23f3

Please sign in to comment.