Skip to content

Commit

Permalink
make auth provider configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
fjakobs committed Feb 22, 2023
1 parent 2e22c8f commit 38b498c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/DBSQLClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<IDBSQLClient> {
this.authProvider = new PlainHttpAuthentication({
async connect(options: ConnectionOptions, authProvider?: IAuthentication): Promise<IDBSQLClient> {
this.authProvider = authProvider || new PlainHttpAuthentication({
username: 'token',
password: options.token,
headers: {
Expand Down

0 comments on commit 38b498c

Please sign in to comment.