Skip to content

Commit 30c8a58

Browse files
committed
[client] fix backward compatibility
1 parent 245a7f4 commit 30c8a58

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/client.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export class Client {
2222

2323
/**
2424
* @param login The login to use for authentication, pass empty string for JWT
25-
* @param passwordOrToken The password or JWT to use for authentication
25+
* @param password The password or JWT to use for authentication
2626
* @param httpClient The HTTP client to use for requests
2727
* @param baseUrl The base URL to use for requests. Defaults to {@link BASE_URL}.
2828
*/
2929
constructor(
3030
login: string,
31-
passwordOrToken: string,
31+
password: string,
3232
httpClient?: HttpClient,
3333
baseUrl = BASE_URL
3434
) {
@@ -39,15 +39,15 @@ export class Client {
3939
};
4040

4141
if (login === "") {
42-
if (passwordOrToken === "") {
42+
if (password === "") {
4343
throw new Error("Token is required for JWT authentication");
4444
}
45-
this.defaultHeaders["Authorization"] = `Bearer ${passwordOrToken}`;
45+
this.defaultHeaders["Authorization"] = `Bearer ${password}`;
4646
} else {
47-
if (passwordOrToken === "") {
47+
if (password === "") {
4848
throw new Error("Password is required when using Basic Auth with login");
4949
}
50-
this.defaultHeaders["Authorization"] = `Basic ${Buffer.from(`${login}:${passwordOrToken}`).toString("base64")}`;
50+
this.defaultHeaders["Authorization"] = `Basic ${Buffer.from(`${login}:${password}`).toString("base64")}`;
5151
}
5252
}
5353

0 commit comments

Comments
 (0)