From d73c0ad94239c7a9151de1dd7d189b5afe7aa1e1 Mon Sep 17 00:00:00 2001 From: freddieptf Date: Wed, 17 Jan 2024 20:29:28 +0300 Subject: [PATCH] do basic auth correct --- src/lib/cht-api.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/cht-api.ts b/src/lib/cht-api.ts index 2f7bc45f..0d3da1f1 100644 --- a/src/lib/cht-api.ts +++ b/src/lib/cht-api.ts @@ -50,10 +50,15 @@ export class ChtApi { public static async createSession(authInfo: AuthenticationInfo, username : string, password: string): Promise { const COUCH_AUTH_COOKIE_NAME = 'AuthSession='; const protocol = authInfo.useHttp ? 'http' : 'https'; - const sessionUrl = `${protocol}://${username}:${password}@${authInfo.domain}/_session`; + const sessionUrl = `${protocol}://${authInfo.domain}/_session`; const resp = await axios.post(sessionUrl, { name: username, password, + }, { + auth: { + username:username, + password: password + } }); const setCookieHeader = (resp.headers as AxiosHeaders).get('set-cookie') as AxiosHeaders; const sessionToken = setCookieHeader?.[0].split(';')