From 38b498c5f8ee6bf89da99c83236981025d80a228 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 22 Feb 2023 17:04:02 +0100 Subject: [PATCH] make auth provider configurable --- lib/DBSQLClient.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/DBSQLClient.ts b/lib/DBSQLClient.ts index a40c740e..406377b9 100644 --- a/lib/DBSQLClient.ts +++ b/lib/DBSQLClient.ts @@ -84,12 +84,13 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient { * Connects DBSQLClient to endpoint * @public * @param options - host, path, and token are required + * @param authProvider - Optional custom authentication provider * @returns Session object that can be used to execute statements * @example * const session = client.connect({host, path, token}); */ - async connect(options: ConnectionOptions): Promise { - this.authProvider = new PlainHttpAuthentication({ + async connect(options: ConnectionOptions, authProvider?: IAuthentication): Promise { + this.authProvider = authProvider || new PlainHttpAuthentication({ username: 'token', password: options.token, headers: {