File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -84,18 +84,21 @@ export default class DBSQLClient extends EventEmitter implements IDBSQLClient {
8484 * Connects DBSQLClient to endpoint
8585 * @public
8686 * @param options - host, path, and token are required
87+ * @param authProvider - Optional custom authentication provider
8788 * @returns Session object that can be used to execute statements
8889 * @example
8990 * const session = client.connect({host, path, token});
9091 */
91- async connect ( options : ConnectionOptions ) : Promise < IDBSQLClient > {
92- this . authProvider = new PlainHttpAuthentication ( {
93- username : 'token' ,
94- password : options . token ,
95- headers : {
96- 'User-Agent' : buildUserAgentString ( options . clientId ) ,
97- } ,
98- } ) ;
92+ async connect ( options : ConnectionOptions , authProvider ?: IAuthentication ) : Promise < IDBSQLClient > {
93+ this . authProvider =
94+ authProvider ||
95+ new PlainHttpAuthentication ( {
96+ username : 'token' ,
97+ password : options . token ,
98+ headers : {
99+ 'User-Agent' : buildUserAgentString ( options . clientId ) ,
100+ } ,
101+ } ) ;
99102
100103 this . connection = await this . connectionProvider . connect ( this . getConnectionOptions ( options ) , this . authProvider ) ;
101104
You can’t perform that action at this time.
0 commit comments